I am looking for a way to have my puck detect when a phone is within a certain distance to it. I know I can use the signal strength of BLE but I cant seem to see my phone on when I use NRF.findDevices.
Can someone point me in the right direction here?
To do this you need your phone to be advertising a service. If you have iPhone you can use the NRF Connect app to set up a service - any will do - but name it something you can pick out. Once advertising you will see the phone (or more correctly the service) name and be able to pick up the RSSI (signal strength) as part of the advertised data. I don't know about Android, unless this is built in you will need a similar app.
Thanks @Ollie. That is very helpful.
Side topic but does anyone know if there is a way to see what code has been saved to my puck / is running on reset? I am picking up a project from someone else and am trying to figure out what code they have written to the puck already.
at the command prompt dump().
@Wilberforce Thank you.
Just to add to this - if you don't want to install anything on your phone you might be able to set the Puck up as a BLE HID device (http://www.espruino.com/Puck.js+Keyboard) - in which case the phone can be set to automatically connect to it when in range (and you can detect that from the Puck).
You probably want it to appear as a Multimedia key device though since appearing as a normal keyboard can stop the on-screen keyboard displaying on some phones :)
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem