Added debug receiver code and added pull ups to transmitter. Everything seems to be working
1 files added
1 files modified
New file |
| | |
| | | #include <RF24_config.h> |
| | | #include <nRF24L01.h> |
| | | #include <RF24.h> |
| | | #include <printf.h> |
| | | |
| | | RF24 radio(22, 21); // CE, CSN |
| | | const byte address[6] = {'R','E','C','V', '1'}; |
| | | char val[4]; |
| | | |
| | | void setup() { |
| | | // put your setup code here, to run once: |
| | | |
| | | Serial.begin(115200); |
| | | radio.begin(); |
| | | radio.openReadingPipe(0, address); |
| | | radio.setPALevel(RF24_PA_MIN); |
| | | radio.startListening(); |
| | | |
| | | } |
| | | |
| | | void loop() { |
| | | // put your main code here, to run repeatedly: |
| | | |
| | | delay(5); |
| | | radio.startListening(); |
| | | if ( radio.available()) { |
| | | while (radio.available()) { |
| | | |
| | | radio.read(&val, sizeof(val)); |
| | | Serial.print("Received = "); |
| | | Serial.println(val); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | void loop() { |
| | | // put your main code here, to run repeatedly: |
| | | |
| | | //radio.write( &dataToSend, sizeof(dataToSend) ); |
| | | // delay(5000); |
| | | } |