Xinyuan-LilyGO / T-Display-S3

MIT License
729 stars 172 forks source link

Detecting USB Power #260

Closed Arielhh closed 5 days ago

Arielhh commented 1 week ago

Hi, When working with the battery, Is there a way to detect, using code only, when a usb power is connected (not using external components or connecting any additional cables)?

Thx

teastainGit commented 1 week ago

You could monitor the battery voltage (with the pin 4 ADC) which is nominally 3.3 to 4.2 and when it jumps to 5V, you know that USB is connected.

Arielhh commented 1 week ago

Many thanks, it's a good idea, this is exactly what i was trying to do right now :)

Arielhh commented 1 week ago

It working thx 👍