This is the part of code running after connection.
function Connect(){ NRF.connect(macaddress).then(function(g) { gatt = g; return gatt.startBonding(); }).then(function(service) { try{ console.log(gatt.getSecurityStatus()); console.log("Connected"); return setTimeout(() => (gatt.getPrimaryService(serviceUid).catch(onRejected)), 2000); } catch(exception){ console.log(exception); } console.log("Service"); return service.getCharacteristic(characteristcUid).catch(onRejected);}).then(function(characteristic) { console.log(characteristic); console.log("Got:", JSON.stringify(d.buffer)); }); }
and this is what it is returned by the console:
[ BluetoothDevice: { "id": "5b:93:7d:91:e5:7c private-resolvable", "rssi": -39, "data": new Uint8Array([2, 1, 26, 3, 3, 10, 24, 17, 7, 114, 131, 89, 57, 60, 2, 116, 174, 69, 70, 180, 13, 199, 230, 80, 241]).buffer, "services": [ "180a", "f150e6c7-0db4-4645-ae74-023c39598372" ] } ] { "connected": true, "encrypted": false, "mitm_protected": false, "bonded": true } Connected The code run into a problem: Not connected
[ BluetoothDevice: {
"id": "5b:93:7d:91:e5:7c private-resolvable", "rssi": -39, "data": new Uint8Array([2, 1, 26, 3, 3, 10, 24, 17, 7, 114, 131, 89, 57, 60, 2, 116, 174, 69, 70, 180, 13, 199, 230, 80, 241]).buffer, "services": [ "180a", "f150e6c7-0db4-4645-ae74-023c39598372" ]
} ] { "connected": true, "encrypted": false, "mitm_protected": false, "bonded": true } Connected The code run into a problem: Not connected
@Riccardokhm started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
This is the part of code running after connection.
and this is what it is returned by the console: