Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <RF24Network.h>
- #include <RF24.h>
- #include <SPI.h>
- #include <printf.h>
- // nRF24L01(+) radio attached to SPI and pins 8 & 9
- RF24 radio(9,10);
- // Network uses that radio
- RF24Network network(radio);
- // Address of our node
- const uint16_t this_node = 0;
- // Address of the other node
- const uint16_t other_node = 1;
- void setup(void)
- {
- Serial.begin(9600);
- printf_begin();
- SPI.begin();
- radio.begin();
- network.begin(/*channel*/ 90, /*node address*/ this_node);
- }
- void loop(void)
- {
- // Pump the network regularly
- network.update();
- // Is there anything ready for us?
- while ( network.available() )
- {
- // If so, grab it and print it out
- RF24NetworkHeader header;
- static char message[32];
- network.read(header,message,sizeof(message));
- Serial.print("Received: ");
- Serial.println(message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement