How can I detect once a connection has estabilished then run a LoopbackA.setConsole().
I thinking it should automatically switch to LoopbackA.setConsole() then press the button on the puck to return to Bluetooth.setConsole(). I tried the following but it didn't work and I'm assuming it has something to do with switching to LoopbackA.setConsole() before a Bluetooth connection has been established.
LoopbackA.setConsole(1);
setWatch(function() {
Bluetooth.setConsole();
}, BTN, {repeat:true, edge:"rising", debounce:50});
Bluetooth.on('data', function(d) {
if (d[0]=="!" && d[1]=="B") {
var b = d.substr(2,2);
if (b[0]=="1") LED1.write(0|b[1]);
if (b[0]=="2") LED2.write(0|b[1]);
if (b[0]=="3") LED3.write(0|b[1]);
}
});
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.
How can I detect once a connection has estabilished then run a
LoopbackA.setConsole()
.I thinking it should automatically switch to LoopbackA.setConsole() then press the button on the puck to return to Bluetooth.setConsole(). I tried the following but it didn't work and I'm assuming it has something to do with switching to
LoopbackA.setConsole()
before a Bluetooth connection has been established.