// not real code - just to give you an idea
function onAdvertisingData(data) {
if (data.address == known_device_address)
doThingsWithData();
}
The code you have posted above will work, but maintaining a connection will drain the Puck's batteries at 10x the normal rate (you can use NRF.setLowPowerConnection() to fix that, but then it slows down the connection).
In addition, Android phones can only maintain 7 active Bluetooth LE connections - if you're thinking of having multiple devices (and the user may have their own devices as well) you might find that you hit that limit
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.
On Android, why not just do something like:
The code you have posted above will work, but maintaining a connection will drain the Puck's batteries at 10x the normal rate (you can use
NRF.setLowPowerConnection()
to fix that, but then it slows down the connection).In addition, Android phones can only maintain 7 active Bluetooth LE connections - if you're thinking of having multiple devices (and the user may have their own devices as well) you might find that you hit that limit