You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Yes! You probably want to look at https://www.espruino.com/Reference#l_NRF_requestDevice

    For instance there's an example there like this:

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

    Apart from the NRF bit in NRF.requestDevice, the API itself is based on "Web Bluetooth" so you can always Google that and look for examples.

About

Avatar for Gordon @Gordon started