Just IMO, but looking at the Arduino library, it's not arranged very well.
It seems that you can only ever receive a message right after you have transmitted, so the whole onMessage callback is downright confusing. People might just hook onto that callback and assume it'll be called when a message is ready.
Or, worse, they might call the poll function every few milliseconds, which as I understand it will basically flood the network with 0 length transmissions.
It might be better to just add the data received callback to the send function and explicitly explain what's going on.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks - I'll take a look!
Just IMO, but looking at the Arduino library, it's not arranged very well.
It seems that you can only ever receive a message right after you have transmitted, so the whole
onMessage
callback is downright confusing. People might just hook onto that callback and assume it'll be called when a message is ready.Or, worse, they might call the
poll
function every few milliseconds, which as I understand it will basically flood the network with 0 length transmissions.It might be better to just add the data received callback to the
send
function and explicitly explain what's going on.