Chances are you have so many advertising packets being received that it can't output the characters fast enough over BLE. Hence it not appearing to stop - it probably did stop but there was such a backlog it was taking ages.
The sample code definitely does work, but just not if you have a lot of devices or devices that advertise quickly
If you want to use setScan rather than findDevices, make sure you can handle the data fast enough - for instance by just writing everything into an array (arr[d.id]=d)
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.
Chances are you have so many advertising packets being received that it can't output the characters fast enough over BLE. Hence it not appearing to stop - it probably did stop but there was such a backlog it was taking ages.
The sample code definitely does work, but just not if you have a lot of devices or devices that advertise quickly
If you want to use
setScan
rather thanfindDevices
, make sure you can handle the data fast enough - for instance by just writing everything into an array (arr[d.id]=d
)