You are reading a single comment by @user93564 and its replies. Click here to read the full conversation.
  • Hi. I am having a problem when calling a function inside NRF.setScan():

    NRF.setScan(function(d) {
        if (d.id === "xxxx") { 
              //do some stuff here
              setState([0xCC, 0x24, 0x33]); }
    }
    

    When I call setState(), it doesn't return to NRF.setScan:

    function setState(arg) {
        var gatt;  
        NRF.connect(addr).then(function(g) {
          gatt = g;
          return gatt.getPrimaryService("0000ffe5-0000-10­00-8000-00805f9b34fb");
        }).then(function(service) {
          return service.getCharacteristic("0000ffe9-0000­-1000-8000-00805f9b34fb");
        }).then(function(c) {
          characteristic = c;
          return characteristic.writeValue(arg);
        }).then(function() {
          gatt.disconnect();
        });
      }
    

    Any idea why? Other functions return properly, something to do with NRF.connect maybe?

About

Avatar for user93564 @user93564 started