• Hello!
    I am studying the interaction of two puck devices.js
    I need to transfer data from one device to another.
    I use tutorials from the Internet.
    A strange error occurs at the getPrimaryService stage.

    My Code:

    var gatt;
    NRF.requestDevice({ timeout: 5000, filters: [{ namePrefix: 'Puck.js 4bcd' }] }).then(function(device) {
       return device.gatt.connect();
    }).then(function(g) {   
        gatt = g;  
        console.log("4");
    return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
    }).then(function(service) {  
      console.log("5");
      return service.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e");  
    }).then(function(characteristic) {
      console.log("6");
      return characteristic.writeValue("LED3.set()\n");
    }).then(function() {
      gatt.disconnect();
      console.log("OK!");
    });
    
    

    When I call this code

    return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
    

    An error appears:

    Uncaught Error: Unhandled promise rejection: ERR 0x11 (BUSY)
    

    Execution stops, information does not go to the second device.
    I don't understand what the problem is, I couldn't find an answer on the Internet.

About

Avatar for user159492 @user159492 started