You are reading a single comment by @billsalt and its replies. Click here to read the full conversation.
  • Hi @Gordon, I've picked this up again after another interruption. Here's the situation: I have a device with my own custom 128-bit service UUID and characteristics. It is a connectable iBeacon. I can connect easily with LightBlue (iOS) and view/change characteristics. I'm trying to connect to a service and change a characteristic that is an LED (00=off, ff=on). The code below has worked exactly twice, and fails a lot more. Failures are IDE disconnect, and "Uncaught Error: Unhandled promise rejection: No Services found". I can't reproduce when it passes, but it seems to be right after I've loaded a new revision of espruino (the first time). Very frustrating... Any ideas on how to debug what's happening? Code below (you helped me get this fixed last week or two), along with LightBlue screenshots.

    var devices;
    NRF.findDevices(function(devices) {
      if (devices.length < 1) throw new Error("Nothing found!");
      devices[0].gatt.connect().then(function(­g) {
        gatt = g;
        return gatt.getPrimaryService("bbc21523-008e-fe­6b-28ee-d6a44f9cb5da");
      }).then(function(service) {
        return service.getCharacteristic("bbc21525-008e­-fe6b-28ee-d6a44f9cb5da");
      }).then(function(characteristic) {
        characteristic.writeValue(0xff);
      }).then(function() {
        gatt.disconnect();
        console.log("Done!");
      });
    }, 3000);
    

    2 Attachments

    • IMG_6205.PNG
    • IMG_6204.PNG
About

Avatar for billsalt @billsalt started