nrf24l01 interface Arduino Nano

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The following are the program for sending & receiving data using nrf24l01.

The sender sends a text to the receiver. one way communication.

The issue is that when I run the program & see result on serial port at the receiver end , nothing gets displayed. 

 

//sender sending hello world

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte addresses [][6] = {"00001", "00002"};
void setup() {
  radio.begin();
  radio.openWritingPipe(addresses[1]);
  radio.setDataRate(RF24_2MBPS);
  radio.setPALevel(RF24_PA_MIN);
//  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  delay(500);
  }
//receiver receives text 

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte addresses [][6] = {"00001", "00002"};

void setup() {
  Serial.begin(57600);
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.openReadingPipe(1,addresses[1]);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}
void loop() {
  if (radio.available()) {
   char text[32] = " ";
    radio.read(&text, sizeof(text));
    Serial.println(text);

    }
}

 

First Fail & then succeed, this is what Engineering teach me.

Last Edited: Sun. Feb 23, 2020 - 11:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try checking the baud rate on the serial monitor. Also make sure that you check that you have got a working nrf24l01. They are tricky to use as they got no power led to state that they are working.

Also why using your own written code to check that modules are working I have used the example code from the RF24 library that you appears to be using you can try that too.

anshumaan kumar