-
• #2
You can check
process.env.CONSOLE=="USB"
- this will detect if Espruino has a connection to your PC (eg. it appears as a COM port).However it has no way to know if you have an application running on the PC that is looking at what it is printing!
Still experimenting with "the bare PICO" and reached some standalone scenario:
I plan to modify the http://www.espruino.com/Single+Button+Combination+Lock
to automatically run as soon as it got power (save(), onInit ...).
The original code uses console.log to show status which I like to keep when managable.
Is there a way to detect that there is no console attached so I can switch to alternative (LED signals)?
TIA, Uli