NRF24L01 using network library, not working ! help !

Hello everyone,
i would like to thank all of you who read my post and those who tries to help.
So I am learning to make NRF24L01 communicate with many other NRF24L01 so i checked some tutorials online and learned a bit about it. I use on the Transmitter side an arduino Nano connected to the NRF24L01 and on the receiver side an arduino Uno with an NRF24L01. My target is to be able to send an array of data for different variable but for now I am sending only one variable for learning purposes. The problem is that it is not sending any data when using the network library RF24Network. But when i use the RF24 library for just sending data to one module it works nevertheless the attached image is what i receive on the receiver serial monitor when I am using the RF24 library. And the RF24Network is printing "Network not available!".
Note that i used an if instead of while() in the code to be able to check if network is available or not.

My code on the transmitter side is :

#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>


//Defining radio object for the RF24 function pin 9 and 10 of arduino
RF24 radio(9, 10);               // nRF24L01 (CE,CSN)
RF24Network network(radio);      // Include the radio in the network
const uint16_t this_node = 00;   // Address of this node in Octal format ( 04,031, etc)
const uint16_t node01 = 01;  

void setup() {

  SPI.begin();
  radio.begin();
  network.begin(90, this_node);  //(channel, node address)
  radio.setDataRate(RF24_2MBPS);

}

void loop() {
network.update();
 
  unsigned long value = 1;
  RF24NetworkHeader header(node01);     // (Address where the data is going)
  bool ok = network.write(header, &value, sizeof(value)); // Send the data

}// end of void loop()

and for the receiver side:

#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>

// 1st byte is for 
// 2nd byte is for 
// 3rd byte is for 
// 4th byte is for 
// 5th byte is for 
int msgRX[8]; //Message to be transmitted from transmitter

//Defining radio object for the RF24 function pin 9 and 10 of arduino
RF24 radio(9, 10);               // nRF24L01 (CE,CSN)
RF24Network network(radio);      // Include the radio in the network
const uint16_t base = 00;
const uint16_t this_node = 01;   // Address of our node in Octal format ( 04,031, etc)

void setup() {

  SPI.begin();
  radio.begin();
  network.begin(90, this_node); //(channel, node address)
  radio.setDataRate(RF24_2MBPS);

  Serial.begin(9600);

}

void loop() {

  network.update();
  if ( network.available() ) {     // Is there any incoming data?
    RF24NetworkHeader header(base);
    unsigned long incomingData;
    network.read(header, &incomingData, sizeof(incomingData)); // Read the incoming data
    //int value1 = msgRX[0];
    Serial.println(incomingData);
    //digitalWrite(13, value1);
  } else {
    Serial.println("Network not available!");  
  }
  
} // end of void loop()

RF24 monitor result.JPG

RF24 monitor result.JPG

I am not sure why but it just worked ! i changed the module seems the module was not good, but now i receive only one time value on the screen and not a loop

and here is my sketch now:

Transmitter:

#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>



//Defining radio object for the RF24 function
RF24 radio(9, 10);               // nRF24L01 (CE,CSN)
RF24Network network(radio);      // Include the radio in the network
const uint16_t this_node = 00;   // Address of this node in Octal format ( 04,031, etc)
const uint16_t node01 = 01; 


void setup() {
  Serial.begin(9600);
  SPI.begin();
  radio.begin();
  network.begin(90, this_node);  //(channel, node address)
  radio.setDataRate(RF24_2MBPS);
  
}
void loop() {

  
  network.update();
  unsigned long value = 1;
  RF24NetworkHeader header(node01);     // (Address where the data is going)
  bool ok = network.write(header, &value, sizeof(value)); // Send the data
  
}

Receiver:

#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>


//Defining radio object for the RF24 function pin 9 and 10 of arduino
RF24 radio(9, 10);               // nRF24L01 (CE,CSN)
RF24Network network(radio);      // Include the radio in the network
const uint16_t base = 00;
const uint16_t this_node = 01;   // Address of our node in Octal format ( 04,031, etc)

int value;


void setup() {
  
  Serial.begin(9600);
  SPI.begin();
  radio.begin();
  network.begin(90, this_node); //(channel, node address)
  radio.setDataRate(RF24_2MBPS);
  
}
void loop() {
  
  network.update();
  while( network.available() ) {     // Is there any incoming data?
    RF24NetworkHeader header;
    unsigned long incomingData;
    network.read(header, &incomingData, sizeof(incomingData)); // Read the incoming data
    Serial.println("Successful connection -----");
    Serial.println(incomingData);
  }
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.