I am working on a project in which I need two NRF24L01 to communicate. Both the receiver and transmitter are connected to a Breakout Adapter On-Board 3.3V Regulator module. I am using two Arduino nanos to control them. In the transmitters serial monitor it says "Sending: (a number)" which is correct, while the receivers serial monitor isn't writing anything.
Here are my pins:
NRF24L01 ā Nano
VCC: 5V
GND: GND
CE: 7
CSN: 8
SCK: D13
MO: D11
MI: D12
Here is the Transmitters code:
#include <SPI.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN pins
const byte address[6] = "00001";
int counter = 0;
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_LOW);
radio.stopListening();
}
void loop() {
counter++;
Serial.print("Sending: ");
Serial.println(counter);
radio.write(&counter, sizeof(counter));
delay(500);
}
Here is the Receivers code:
#include <SPI.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN pins
const byte address[6] = "00001";
int incomingNumber = 0;
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_LOW);
radio.startListening();
}
void loop() {
if (radio.available()) {
radio.read(&incomingNumber, sizeof(incomingNumber));
Serial.print("Received: ");
Serial.println(incomingNumber);
}
Serial.println(incomingNumber);
}
Any help is appreciated, thank you