Änderungen
Aus Hackerspace Ffm
/* RF24 Library */
== RF24 Library ==
=== Working with dynamic payloads ===
The library is very unintuitive and buggy in this behaviour. To recevie a packet with dynamic payload, do this:
<pre>
if(radio.available()){
uint8_t payloadsize = radio.getDynamicPayloadSize();
if(payloadsize < 1){
// Corrupt payload has been flushed
return;
} else {
radio.setPayloadSize(payloadsize); // THIS IS IMPORTANT TO DO DUE CRAPPY LIB
radio.read(&data,sizeof(data));
}
}
</pre>