"Advertising is just something that's broadcast - you're not guaranteed to receive it on the phone - so I'd suggest using a 'buttonPresses' variable that just increments. On the phone, if that's different from the last time you got an advertising packet you know that the button has been pressed between times.
It beats using something that's set to 1 and then returns to 0, since you could potentially miss all the advertising packets sent while it was 1."
Do you have an example of this? I have my buttonPresses counted and sent via MQTT, but how would my app use it.?
Something like (psuedo) if lastbuttoncount != this buttonCount-1 then... ?
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.
@Gordon In http://forum.espruino.com/comments/13410449/ you stated...
"Advertising is just something that's broadcast - you're not guaranteed to receive it on the phone - so I'd suggest using a 'buttonPresses' variable that just increments. On the phone, if that's different from the last time you got an advertising packet you know that the button has been pressed between times.
It beats using something that's set to 1 and then returns to 0, since you could potentially miss all the advertising packets sent while it was 1."
Do you have an example of this? I have my buttonPresses counted and sent via MQTT, but how would my app use it.?
Something like (psuedo) if lastbuttoncount != this buttonCount-1 then... ?