Detect if REPL is connected
tobz last edited by
How do you detect if there is a console connection present?
Use case is I don't want my device to go into deepsleep if I'm working on it.
timh last edited by
I had a similiar situation where I wish to disable WDT when using console.
I put a jumper cable in between ground and a pin. The check for it on bootup and then if pulled to ground will not start the WDT.
robert-hh last edited by
@tobz If you have the chance to connect one of the modem control signals like RTS to a GPIO port, then you can use that one.
philwilkinson last edited by
I have found myself stuck a few times with ESP8266 as well as ESP32 with exactly the same issue!
The Pyboard has a useful USB_VCP.isconnected method which does exactly the function you are after. However, I am not sure if ESP32 offers that function. Perhaps a Pycom github enhancement request?
As an interim measure I now put in a 30 second delay on a hard reset ( using machine.RESET_CAUSE) allowing me time to interrupt the script.
Not very elegant, but it works.