Page 1 of 1
Detect USB is connected on esp32-s2
Posted: Tue May 23, 2023 3:37 pm
by def1149
How do I detect that the native USB is connected to PC? I use deep sleep and wake up on timer. When the esp32-s2 wakes up I'd like to detect if the USB is connected to the PC.
Re: Detect USB is connected on esp32-s2
Posted: Thu May 25, 2023 9:00 pm
by mikeysklar
With
CircuitPython you can for a PC connect by using:
Code: Select all
supervisor.runtime.serial_connected
supervisor.runtime.usb_connected
You can try the suggestion here from a
reddit thread that uses usb_dev.
If the above does't work out you could set a pin alarm and tie the USB power pin to another GPIO and use it as an interrupt.