Puck.js can have both an incoming and an outgoing bluetooth connection, so in the example you're trying you should be fine - you can be connected with your PC while also running the code above and seeing the response.
But yes, even if you're connected to something else at the same time you have other ways to debug.
That way you can get the command-prompt even when you are connected to something else via bluetooth. Only thing to watch out for is to type Serial.setConsole(1) to force the command prompt to stay on serial, even when Bluetooth is connected.
If you're doing serious development then I'd recommend just leaving a Puck wired up like that.
Loopback
You can also force the console onto 'Loopback' which means that anything printed to LoopbackA appears on LoopbackB and vice-versa.
Not tested, but something like the following should work:
Basically you'd connect with the other device, then press the button and from then on, stuff gets logged in 'log'. Next time you connect with your PC (without pressing the button) log will contain everything that happened.
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.
Puck.js can have both an incoming and an outgoing bluetooth connection, so in the example you're trying you should be fine - you can be connected with your PC while also running the code above and seeing the response.
But yes, even if you're connected to something else at the same time you have other ways to debug.
Serial connection
You can attach a USB-TTL serial converter to Puck.js: http://www.espruino.com/Puck.js#serial-console
That way you can get the command-prompt even when you are connected to something else via bluetooth. Only thing to watch out for is to type
Serial.setConsole(1)
to force the command prompt to stay on serial, even when Bluetooth is connected.If you're doing serious development then I'd recommend just leaving a Puck wired up like that.
Loopback
You can also force the console onto 'Loopback' which means that anything printed to
LoopbackA
appears onLoopbackB
and vice-versa.Not tested, but something like the following should work:
Basically you'd connect with the other device, then press the button and from then on, stuff gets logged in 'log'. Next time you connect with your PC (without pressing the button)
log
will contain everything that happened.