[nRF24] Updated examples

This commit is contained in:
jgromes 2019-06-02 15:03:53 +02:00
parent 6e7c28181e
commit 036bc02bad
2 changed files with 35 additions and 5 deletions

View file

@ -8,13 +8,23 @@
- data rate - data rate
- transmit pipe on transmitter must match receive pipe - transmit pipe on transmitter must match receive pipe
on receiver on receiver
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
#include <RadioLib.h> #include <RadioLib.h>
// nRF24 is in slot A on the shield // nRF24 has the following connections:
nRF24 nrf = RadioShield.ModuleA; // NSS pin: 10
// CE pin: 2
// IRQ pin: 3
nRF24 nrf = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//nRF24 nrf = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -78,5 +88,10 @@ void loop() {
// timeout occurred while waiting for a packet // timeout occurred while waiting for a packet
Serial.println(F("timeout!")); Serial.println(F("timeout!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
} }
} }

View file

@ -8,13 +8,23 @@
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
Packet delivery is automatically acknowledged by the receiver. Packet delivery is automatically acknowledged by the receiver.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
#include <RadioLib.h> #include <RadioLib.h>
// nRF24 is in slot A on the shield // nRF24 has the following connections:
nRF24 nrf = RadioShield.ModuleA; // NSS pin: 10
// CE pin: 2
// IRQ pin: 3
nRF24 nrf = new Module(10, 2, 3);
// or using RadioShield
// https://github.com/jgromes/RadioShield
//nRF24 nrf = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
@ -74,6 +84,11 @@ void loop() {
// timed out while transmitting // timed out while transmitting
Serial.println(F("timeout!")); Serial.println(F("timeout!"));
} else {
// some other error occurred
Serial.print(F("failed, code "));
Serial.println(state);
} }
// wait for a second before transmitting again // wait for a second before transmitting again