Looks like in the new code you changed to checking status==1 so you also need to set status=0 in device.on('gattserverdisconnected', function() {
You could try sending uart.write("\x03\x10digitalWrite(LED1, 0),digitalWrite(D29, 0);\n");} to the MDBT42
Newer firmwares (2v15 I think?) will auto-clear the input line when Bluetooth disconnects/connects so it's not needed, but on earlier versions, if a send half-completed and you were left with digitalWr on the input line (for instance) you'd then end up with Espruino trying to execute:
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.
Looks like in the
new
code you changed to checkingstatus==1
so you also need to setstatus=0
indevice.on('gattserverdisconnected', function() {
You could try sending
uart.write("\x03\x10digitalWrite(LED1, 0),digitalWrite(D29, 0);\n");}
to the MDBT42Newer firmwares (2v15 I think?) will auto-clear the input line when Bluetooth disconnects/connects so it's not needed, but on earlier versions, if a send half-completed and you were left with
digitalWr
on the input line (for instance) you'd then end up with Espruino trying to execute:Which would fail and not light any lights...