-
• #2
Yes, absolutely. The easiest thing to do is to use
NRF.requestDevice
: http://www.espruino.com/Reference#l_NRF_requestDeviceNRF.requestDevice({ timeout:500, filters: [{ namePrefix: 'Puck.js' }] }).then(function(device) { ...device.rssi... }).catch(function() { // device not in range });
In the example above I added a timeout of 0.5 sec (the default is 2). When Scanning the device uses quite a lot of power compared to normal, so really you want to scan as rarely and for as short a period as possible (unless you're not battery powered of course).
Could i use a puck.js to detect another puck presence, i.e. have one in the car and another in the garrage, and use the one in the garrage to detect the one in the car, i.e. rssi level and act when rssi level is at certain value?
Thanks