• I think an app is the safest solution then. What I'd suggest is:

    • Write an app that listens for BLE advertising events - when it sees the one from the Puck.js address it's set up to work with, it'd look at the advertising data and see what was in the data. Depending on that it'd make a call or do something else
    • You could also send battery status if needed, and the phone app could also show an alert if it hadn't got advertising packets in a while (eg, Puck.js had gone out of range)
    • On the Puck, use NRF.setAdvertising({ 0x1234 : [buttonNumber, buttonPresses] }) when the button is pressed in the way you want (which you use setWatch for)

    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.

About

Avatar for Gordon @Gordon started