[nRF24] Added links to default config wiki page
This commit is contained in:
parent
bd559b57f1
commit
d867bc043a
2 changed files with 19 additions and 21 deletions
|
@ -9,6 +9,9 @@
|
||||||
- transmit pipe on transmitter must match receive pipe
|
- transmit pipe on transmitter must match receive pipe
|
||||||
on receiver
|
on receiver
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#nrf24
|
||||||
|
|
||||||
For full API reference, see the GitHub Pages
|
For full API reference, see the GitHub Pages
|
||||||
https://jgromes.github.io/RadioLib/
|
https://jgromes.github.io/RadioLib/
|
||||||
*/
|
*/
|
||||||
|
@ -20,22 +23,18 @@
|
||||||
// CS pin: 10
|
// CS pin: 10
|
||||||
// IRQ pin: 2
|
// IRQ pin: 2
|
||||||
// CE pin: 3
|
// CE pin: 3
|
||||||
nRF24 nrf = new Module(10, 2, 3);
|
nRF24 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or using RadioShield
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
//nRF24 nrf = RadioShield.ModuleA;
|
//nRF24 radio = RadioShield.ModuleA;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// initialize nRF24
|
// initialize nRF24 with default settings
|
||||||
Serial.print(F("[nRF24] Initializing ... "));
|
Serial.print(F("[nRF24] Initializing ... "));
|
||||||
// carrier frequency: 2400 MHz
|
int state = radio.begin();
|
||||||
// data rate: 1000 kbps
|
|
||||||
// output power: -12 dBm
|
|
||||||
// address width: 5 bytes
|
|
||||||
int state = nrf.begin();
|
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,7 +49,7 @@ void setup() {
|
||||||
// methods (5 by default)
|
// methods (5 by default)
|
||||||
Serial.print(F("[nRF24] Setting address for receive pipe 0 ... "));
|
Serial.print(F("[nRF24] Setting address for receive pipe 0 ... "));
|
||||||
byte addr[] = {0x01, 0x23, 0x45, 0x67, 0x89};
|
byte addr[] = {0x01, 0x23, 0x45, 0x67, 0x89};
|
||||||
state = nrf.setReceivePipe(0, addr);
|
state = radio.setReceivePipe(0, addr);
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,12 +67,12 @@ void loop() {
|
||||||
// See example ReceiveInterrupt for details
|
// See example ReceiveInterrupt for details
|
||||||
// on non-blocking reception method.
|
// on non-blocking reception method.
|
||||||
String str;
|
String str;
|
||||||
int state = nrf.receive(str);
|
int state = radio.receive(str);
|
||||||
|
|
||||||
// you can also receive data as byte array
|
// you can also receive data as byte array
|
||||||
/*
|
/*
|
||||||
byte byteArr[8];
|
byte byteArr[8];
|
||||||
int state = nrf.receive(byteArr, 8);
|
int state = radio.receive(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (state == ERR_NONE) {
|
if (state == ERR_NONE) {
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
Packet delivery is automatically acknowledged by the receiver.
|
Packet delivery is automatically acknowledged by the receiver.
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#nrf24
|
||||||
|
|
||||||
For full API reference, see the GitHub Pages
|
For full API reference, see the GitHub Pages
|
||||||
https://jgromes.github.io/RadioLib/
|
https://jgromes.github.io/RadioLib/
|
||||||
*/
|
*/
|
||||||
|
@ -20,22 +23,18 @@
|
||||||
// CS pin: 10
|
// CS pin: 10
|
||||||
// IRQ pin: 2
|
// IRQ pin: 2
|
||||||
// CE pin: 3
|
// CE pin: 3
|
||||||
nRF24 nrf = new Module(10, 2, 3);
|
nRF24 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or using RadioShield
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
//nRF24 nrf = RadioShield.ModuleA;
|
//nRF24 radio = RadioShield.ModuleA;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// initialize nRF24
|
// initialize nRF24 with default settings
|
||||||
Serial.print(F("[nRF24] Initializing ... "));
|
Serial.print(F("[nRF24] Initializing ... "));
|
||||||
// carrier frequency: 2400 MHz
|
int state = radio.begin();
|
||||||
// data rate: 1000 kbps
|
|
||||||
// output power: -12 dBm
|
|
||||||
// address width: 5 bytes
|
|
||||||
int state = nrf.begin();
|
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,7 +49,7 @@ void setup() {
|
||||||
// methods (5 by default)
|
// methods (5 by default)
|
||||||
byte addr[] = {0x01, 0x23, 0x45, 0x67, 0x89};
|
byte addr[] = {0x01, 0x23, 0x45, 0x67, 0x89};
|
||||||
Serial.print(F("[nRF24] Setting transmit pipe ... "));
|
Serial.print(F("[nRF24] Setting transmit pipe ... "));
|
||||||
state = nrf.setTransmitPipe(addr);
|
state = radio.setTransmitPipe(addr);
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,7 +64,7 @@ void loop() {
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to
|
// you can transmit C-string or Arduino string up to
|
||||||
// 32 characters long
|
// 32 characters long
|
||||||
int state = nrf.transmit("Hello World!");
|
int state = radio.transmit("Hello World!");
|
||||||
|
|
||||||
if (state == ERR_NONE) {
|
if (state == ERR_NONE) {
|
||||||
// the packet was successfully transmitted
|
// the packet was successfully transmitted
|
||||||
|
|
Loading…
Add table
Reference in a new issue