Thanks for your help Gordon. This is a nice little example to do with the puck by itself.
For anyone else, finished code to be used along with the adafruit bluefruit app is below.
NRF.on('connect', function(addr) {
LoopbackA.setConsole();
});
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]);
if (b[0]=="4") digitalWrite([LED1, LED2, LED3], b[1]*7);
}
});
Just remeber to press the btn on the puck if you want to send some new code to the puck
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.
Thanks for your help Gordon. This is a nice little example to do with the puck by itself.
For anyone else, finished code to be used along with the adafruit bluefruit app is below.
Just remeber to press the btn on the puck if you want to send some new code to the puck