nRF24 / RF24

OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
https://nrf24.github.io/RF24
GNU General Public License v2.0
2.23k stars 1.02k forks source link

Radio.write return always true #666

Closed bprovvis closed 3 years ago

bprovvis commented 4 years ago

hello my project

raspberry MASTER ----->Arduino uno SLAVE

It works fine but in raspberry Radio.write return always true even when Arduino SLAVE is turned off

my code if(radio.begin() ) { printf("Begin() OK \n") ; } radio.setDataRate(RF24_250KBPS); radio.setPALevel(RF24_PA_MIN ); radio.setAutoAck(false); radio.setRetries(15,15); radio.openWritingPipe(pipes_for); radio.openReadingPipe(1,pipes_for);

// First, stop listening so we can talk. radio.stopListening(); bool ok = radio.write( &messaggio_to_slave, sizeof(messaggio_to_slave) );

if (ok){
  cont_ok++;

  printf("Write ok...to Slave ");printf("%d",i);printf(" Conteggio OK ");printf("%d \n",cont_ok);
  }

else { cont_fail++;

  printf("failed Write... to slave ");printf("%d",i);printf("Conteggio ");printf("%d \n",cont_fail);
  }

thanks for any help

Avamander commented 4 years ago

I saw this once when my module's power supply was garbage. How's yours?

2bndy5 commented 4 years ago

radio.setAutoAck(false);

write() will always return true because you're telling the master to not wait for an acknowledgement from the slave node. Therefore, the only thing left to report is if the master attempted to send anything (which will always be true). Read the docs about setAutoAck().

bprovvis commented 3 years ago

hello sorry for the delay I had some problems i try radio.setAutoAck(true); and is all OK thanks