Arduino nrf24l01+ addressing problem

hello, I have source code with arduino nrf24l01 as below. Currently I can send and receive data over two wireless networks, but when I change addresses, communication is not possible.

Server-master device

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
#include <ArduinoJson.h>
#include "printf.h"


RF24 radio(8, 7);  // nRF24L01 (CE-8,CSN-7)
RF24Network network(radio);

const uint16_t this_node = 00;
const uint16_t receiver_node= 01;

DynamicJsonDocument doc(1024);
String serialPortReceivedData;

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

void loop() {
  char received_data[32] = "";

  if (Serial.available() > 0) {

    serialPortReceivedData = "";
    doc.clear();

    serialPortReceivedData = Serial.readString();
    deserializeJson(doc, serialPortReceivedData);

  }
  //Send to node
  RF24NetworkHeader master_header(receiver_node);
  bool ok = network.write(master_header, &serialPortReceivedData, sizeof(serialPortReceivedData));
  Serial.println(ok);
  delay(1000);


  //Get node data
  network.update();
  while (network.available()) {
    RF24NetworkHeader client_header;
    network.read(client_header, &received_data, sizeof(received_data));
    Serial.println(received_data);
  }
}

Client node

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

RF24 radio(9, 10);  // nRF24L01 (CE,CSN)

RF24Network network(radio);  // Include the radio in the network

const uint16_t master00 = 00;
const uint16_t this_node= 01;

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

void loop() {
  char received_data[32] = "";
  const char send_data[] = "Client...";

  //Get to server data
  network.update();
  while (network.available()) {
    RF24NetworkHeader client_header;
    network.read(client_header, &received_data, sizeof(received_data));
    Serial.println(received_data);
  }
  Serial.println(received_data);
  Serial.println("read data: ");

  //Send to server data
  RF24NetworkHeader master_header(master00);
  bool ok = network.write(master_header, &gidecek_veri, sizeof(gidecek_veri));
  Serial.println(ok);
  delay(1000);

}

This way the application works fine, but the only problem is const uint16_t receiver_node= 01; When I change this address, that is, "025" is like this, data cannot be sent

When the address changes, there is no communication, how can I fix this problem? I don't want to break the code structure.

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