I have tried to make communication with arduino mega and a nano.
even if the transmitter not available arduino mega as a receiver get garbage data like ??????????
I have disconnected the nrf24l01 module but still mega is showing empty data in the serial monitor.
I have debug the code by writing if radio available then show data.
and now it showing data in infinite loop in the serial monitor.
// SimpleRx - the slave or the receiver
#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;
}
}
this code showing "Data received" again and again
without connecting the nrf
just uploading the code to mega showing this
how it is getting radio signal I don't know
Go to the tutorial I linked to in post #2. Scroll down that tutorial until you get to post #30. In post #30 there is a sketch called CheckConnection.ino. You will need to modify it for your CE & CSN pins but it should run ok after that. It will print out some information from the nRF24L01 module that will indicate if the sketch is communicating with the module.
I could be wrong here but I think there were some discussions a while back around an update to the nRF24L01 library. I wonder if there is an incompatibility between the demos and the latest library.
Hopefully one of the other form members who has more knowledge than me will jump in and advise you further.
yeah you are right.
nrf is not communicating with mega properly
every time I open the serial monitor is shows different value then previous.
and some address are also 0x00
so there is an issue.
Do you have any idea to solve this.
I have checked the connection and wiring with continuity test.
seems ok to me.
but what is the issue with that I don't know.
and its a new mega
Those modules give a lot of people problems when powered with an Arduino, the solution most of the time is to use an external power supply. You will find many kludges such as adding capacitors etc, none are 100%.
with ce 9 and csn to 53
after setting ce to 53 and csn to 9 in sketch
then each time I open serial monitor it shows either 0x08 to all
or 0xc5 to all
but not constant..
but with ce 9 and csn 53 it defaults to 0x08.
Ok. It seems that CE and CSN were the correct way round to begin with. Your post above shows that the data rate reported back hasn't changed. Your post #10 at least appears to show the reported data rate has changed.
I've not used nRF24L01 modules for a while now, but as I mentioned earlier, I think there might have been a library update that broke some of the early examples.
There are other forum members that have more recent experience of the nRF24L01 and they may be able to advise you further.