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-1000-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?
@user93564 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.
Hi. I am having a problem when calling a function inside NRF.setScan():
When I call setState(), it doesn't return to NRF.setScan:
Any idea why? Other functions return properly, something to do with NRF.connect maybe?