NRF.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).
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.
Yes, absolutely. The easiest thing to do is to use
NRF.requestDevice
: http://www.espruino.com/Reference#l_NRF_requestDeviceIn 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).