Hello everyone,
this is my first post here, so dont flame me, please.
I have an arduino uno as a reciever and an arduino nano as a sender. I have double-checked the connections and they seem to be good. Both NRF24's are detected, but the recieving arduino doesnt get any data.
I have both NRF24 circuits connected to a 3,3V regulator, one supplied with 5V (reciever) and one supplied with 9V (sender). On both devices I added a 100nF Capacitor between the Vcc and GND at the regulators.
Pls help....
Sender:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8);
const byte address[6] = "00021";
int x = 0;
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(2, INPUT);
bool result = radio.isChipConnected();
Serial.println(result);
}
void loop() {
if (digitalRead(3) == HIGH)
{
const char text[] = "LEFT";
radio.write(&text, sizeof(text));
Serial.println(text);
delay(3);
}
else if (digitalRead(4) == HIGH)
{
const char text[] = "RIGHT";
radio.write(&text, sizeof(text));
Serial.println(text);
delay(3);
}
else if (digitalRead(2) == HIGH)
{
const char text[] = "UP";
radio.write(&text, sizeof(text));
Serial.println(text);
delay(3);
}
else if (digitalRead(5) == HIGH)
{
const char text[] = "DOWN";
radio.write(&text, sizeof(text));
Serial.println(text);
delay(3);
}
else if (digitalRead(6) == HIGH)
{
const char text[] = "START";
radio.write(&text, sizeof(text));
Serial.println(text);
delay(3);
}
}
Reciever:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00021";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
bool result = radio.isChipConnected();
Serial.println(result);
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
}
Thank you!