You are reading a single comment by @dave_irvine and its replies. Click here to read the full conversation.
  • @Gordon more interesting behaviour. I have the following code running:

    function getDevices() {
      LED1.set();
      NRF.findDevices(function(foundDevices) {
        LED1.reset();
        foundDevices.forEach(function (device) {
          if (device.name && device.name.indexOf('Puck.js') >= 0) {
            const data = device.data.toString();
            
            Bluetooth.println(JSON.stringify({
              name: device.name,
              rssi: device.rssi,
              data: data,
            }));
          }
        });
      }, 250);
    }
    
    setInterval(getDevices, 2000);
    

    This can run fine for ages, but sometimes I get the edge case where the LED remains on (so NRF.findDevices is never returning), which requires me to reset the device as it is no longer discoverable via the IDE.

    Equally, if I am connected to the device via the IDE and then disconnect, about 25% of the time the device gets stuck, either with the LED on or off.

    Any idea what might be going on?

About

Avatar for dave_irvine @dave_irvine started