Änderungen

Aus Hackerspace Ffm
Wechseln zu: Navigation, Suche

NRF24L01 Issues

454 Byte hinzugefügt, 20:13, 6. Mär. 2017
/* 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>
1.954
Bearbeitungen