0

the function write in nrf24LO1 (without antenna) works perfectly
but in nrf24LO1 (with antenna) not works. why?!
the code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>

 RF24 radio(7,8);
 const byte address[6] = "00001";
void setup() {
  radio.begin();
  radio.setDataRate(RF24_250KBPS);
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_HIGH);
  radio.setCRCLength(RF24_CRC_8); 
  radio.stopListening();
  Serial.begin(9600);
}

void loop() {
  const char text[] = "example";
  if(radio.write(&text,sizeof(text))) //<==problem here
    Serial.println("ok");
  Serial.println(text);
  delay(1000);
}

nrf24l01 with antenna :
enter image description here
nrf24l01 without antenna :
enter image description here

  • In what way does it "not works"? – Majenko May 19 at 22:17
  • not works : Not send data , function write return false with 0 data sending to recever – user66455 May 19 at 22:31
  • what makes you believe that the two modules are interchangeable? .. btw, both of the modules have an antenna – jsotola May 20 at 1:27
  • They actually are interchangeable. But your program has an error radio.write expects a pointer to some data. An array and a pointer are pretty much the same in C (this is a bit oversimplified but sufficient in this case). But you are passing a pointer to an array (the address of the array), which in turn would be a pointer to a pointer to data. Your program may or may not work just because of pure luck and the current flow of aether. Remove the apmersand in that method call. – Kwasmich May 20 at 6:18
  • 1
    Try increasing the distance between the two. Or use RF24_PA_LOW during testing. – Gerben May 20 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.