RF24
RF24 copied to clipboard
Problem with delay after write()
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.