• I'm using the code example from the Bluetooth LE page, modified for my device:

    var devices;
    
    NRF.findDevices(function(d) {
      if (devices.length < 1) throw new Error("Nothing found!");
      devices[0].gatt.connect().then(function(­g) {
        gatt = g;
        return gatt.getPrimaryService("0xbbc21523-008e-­fe6b-28ee-d6a44f9cb5da");
      }).then(function(service) {
        return service.getCharacteristic("0xbbc21525-00­8e-fe6b-28ee-d6a44f9cb5da");
      }).then(function(characteristic) {
        characteristic.writeValue( 0xff );
      }).then(function() {
        gatt.disconnect();
        console.log("Done!");
      });
    }, 2000);
    
    
    >
    =undefined
    Uncaught Error: Field or method "length" does not already exist, and can't create it on undefined
     at line 1 col 12
    if (devices.length < 1) throw new Error("Nothing found!");
               ^
    in function called from system
    > 
    

    I'm getting an error above that I think is a simple coding error, but I copied it directly. My goof, or documentation error?

About

Avatar for billsalt @billsalt started