You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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-cĀ­onsole

    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:

    var log = "";
    LoopbackB.on('data',function(d) {log+=d;});
    setWatch(function() {
      LoopbackA.setConsole();
    }, BTN, {repeat:true,edge:"rising"});
    

    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.

About

Avatar for Gordon @Gordon started