How do I detect through code if USB power is plugged in? (Arduino IDE)
I can tell with my own eyes if the USB is plugged in. I can upload and run code fine. I can see the red light.
What I’m trying to do is detect through code if USB power is plugged in, while the XIAO is running. I want to use this to run a different LED animation when the USB power is plugged in, to indicate the battery is charging.
PS. I already know how to read the battery level, that’s not what I’m asking here.