RF24 icon indicating copy to clipboard operation
RF24 copied to clipboard

Problem with delay after write()

Open RollingGecko opened this issue 9 years ago • 0 comments

I have a small trial code with a struct to be send. Works great. But when I enter directly after the write() a delay greater than 10, No data can be received and the write function returnes a false.

Her the code snipped:

void loop()
{ remPack.valXJoy = analogRead(JOYSTICK_X); remPack.valYJoy = analogRead(JOYSTICK_Y); Serial.print("X= "); Serial.print(remPack.valXJoy);Serial.print(" Y= "); Serial.println(remPack.valYJoy);

radio.write( &remPack, sizeof(remPack) );

delay(10); }

On the receiver side I tried both if ( radio.available() ) and while ( radio.available() ). Both with the same result:

Snipped:

if ( radio.available() ) { bool done = false; while (!done) { done = radio.read( &remPack, sizeof(remPack) ); }

This is an issue, that is allready in discussion also on stackexchange: https://arduino.stackexchange.com/questions/8129/arduino-rf24-library-delay-after-write-function-causes-no-byte-availability

But here is no real solution for this problem.

RollingGecko avatar Sep 06 '15 10:09 RollingGecko