Hello everybody,
I have been trying to establish wireless communication between two Arduinos for a few weeks now. I researched and came across the nrf24l01 module and ordered two directly (the version with the external antenna with a further range).
I took an Arduino Uno and an Arduino Nano, and connected the module:
vcc = 5v (I got an adapter that regulates down to 3.3v)
gnd = gnd
ce = 7
csn = 8
sck = 13
mo = 11
mi = 12
My goal was first to send the message "Hello World" from the Arduino Uno to the Arduino Nano and to read it over the serial monitor.
For this I first downloaded and integrated the "RF24" library from TMRh20, version 1.34. Then I loaded the following two codes onto my two Arduino boards:
Transmitter:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio (7, 8); // CE, CSN
const byte address [6] = "00001";
void setup () {
radio.begin ();
radio.openWritingPipe (address);
radio.setPALevel (RF24_PA_MIN);
radio.stopListening ();
}
void loop () {
const char text [] = "Hello World";
radio.write (& text, sizeof (text));
delay (1000);
}
Receiver:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio (7, 8); // CE, CSN
const byte address [6] = "00001";
void setup () {
Serial.begin (9600);
radio.begin ();
radio.openReadingPipe (0, address);
radio.setPALevel (RF24_PA_MIN);
radio.startListening ();
}
void loop () {
if (radio.available ()) {
char text [32] = "";
radio.read (& text, sizeof (text));
Serial.println (text);
}
}
However, when I now open the serial monitor of my Arduino Nano, there is nothing there.
Could it be that the code is incorrect or that the module is broken?
I would really appreciate help.
Thanks a lot:)