You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • @allObjects personally I think that's just complicating matters.

    @Coder2012 Basically you have the 'console' - the thing on the Espruino that lets you enter code on the left-hand side of the Web IDE. When you're connected to a PC via USB, it's moved to USB, and when you're not it's moved to Serial1 (bluetooth).

    You can force it to be on one or the other using the commands Serial1.setConsole(); or USB.setConsole();.

    So now, the thing that really messes you up: When the console is on a device (like Serial1), the on('data',...) handler doesn't work.

    For what you want, I'd suggest you actually just use everything the console gives you. So, if you've written a bunch of functions then you can just execute one of them by sending the text myFunction(some,args);\n.

    When you do that you'll get the characters you send echo'd back to you, but you can fix that by sending echo(0)\n - you need to send 1 to turn echo back on though.

    Hope that helps!

About

Avatar for Gordon @Gordon started