I think since you pass the device into ble_uart, you could do something like:
NRF.requestDevice({ filters: [{ namePrefix: 'Puck.js' }] }).then(function(device) { device.on('passkeyRequest', function() { device.sendPasskey("123456"); }); return ble_uart.connect(device); }).then(function(uart) { uart.on('data', function(d) { print("Got:"+JSON.stringify(d)); }); uart.eval('E.getTemperature()').then(function(data) { print("Got temperature "+data); uart.write("digitalPulse(LED,1,10);\n"); // .then(...) }); setTimeout(function() { uart.disconnect(); console.log("Disconnected"); }, 2000); });
Not tested though
@Gordon 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.
I think since you pass the device into ble_uart, you could do something like:
Not tested though