I'm using this tutorial to receive data from an nRF24L01+ from my PIC16F1829 (TX).https://forum.arduino.cc/t/simple-nrf24l01-2-4ghz-transceiver-demo/405123/2
I am using an Arduino Nano connected to the nRF24L01+ as the RX using this code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
const byte thisSlaveAddress[5] = {'R','x','A','A','A'};
RF24 radio(CE_PIN, CSN_PIN);
char dataReceived[10]; // this must match dataToSend in the TX
bool newData = false;
//===========
void setup() {
Serial.begin(9600);
Serial.println("SimpleRx Starting");
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.openReadingPipe(1, thisSlaveAddress);
radio.startListening();
}
//=============
void loop() {
getData();
showData();
}
//==============
void getData() {
if ( radio.available() ) {
radio.read( &dataReceived, sizeof(dataReceived) );
newData = true;
}
}
void showData() {
if (newData == true) {
Serial.print("Data received ");
Serial.println(dataReceived);
newData = false;
}
}
Even when I take off the nRF24L01+ so there is no connections at all, so its just the USB connected to the nano, all I get in the serial monitor is "Data received" being spammed very fast. I have bought new nRF modules and swapped them out, tried uninstalling and reinstalling the IDE, and I can't understand why it is just saying "Data received". Anything would help, as I am fairly new to Arduinos. Thank you.