maniacbug / RF24

Arduino driver for nRF24L01
http://maniacbug.github.com/RF24
948 stars 773 forks source link

The NRF24L01 receiver isn't receiving the message #102

Open shreyassahu opened 2 years ago

shreyassahu commented 2 years ago

//Transmitter code

include //NRF24L01 library created by TMRh20 https://github.com/TMRh20/RF24

include

include

int SentMessage[1] = {111}; RF24 radio(7,8); // NRF24L01 used SPI pins + Pin 9 and 10 on the NANO

const byte address[6] = "node1"; // Needs to be the same for communicating between 2 NRF24L01

void setup() { // pinMode(SwitchPin, INPUT_PULLUP); // digitalWrite(SwitchPin,HIGH);

radio.begin(); // Start the NRF24L01 radio.openWritingPipe(address); // Get NRF24L01 ready to transmit }

void loop() {

  SentMessage[0] = {111};
  radio.write(SentMessage, 1);
  delay(100);

}

//Receiver Code

include

include

include

int RELAY=4; RF24 radio(7, 8); // CE, CSN int receivedMessage[1] = {111}; const byte address[6] = "node1"; void setup() { // Serial.begin(9600); radio.begin(); radio.openReadingPipe(1, address); // radio.setPALevel(RF24_PA_MIN); radio.startListening(); pinMode(RELAY,LOW); }

void loop() { while(radio.available()) { radio.read(receivedMessage,1);

if(receivedMessage[0] == 111)
{
  digitalWrite(RELAY,HIGH);
}
else
{
  digitalWrite(RELAY,LOW);
}

// delay(2); } }

I am working on an automation project that uses NRF24L01 modules connected to an Arduino UNO(the receiver) and Arduino Nano(the transmitter). I have done the connections correctly. The receiver end doesn't work (the relay is not turning on) even though the transmitter is transmitting the message with the same address. What seems to be the issue here?

chricloud9 commented 2 years ago

Having a similar issue on an STM32. Won't receive even though the transmitter is sending.

Have you checked the RPD address to see if it's receiving power to the receiver antenna?