Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery indicator and USB recognition for T-QT Pro #25

Open
mrudick1 opened this issue Mar 29, 2023 · 2 comments
Open

Battery indicator and USB recognition for T-QT Pro #25

mrudick1 opened this issue Mar 29, 2023 · 2 comments

Comments

@mrudick1
Copy link

Hello,

I would like to create a battery indicator that also recognizes if the T-QT Pro is plugged in and charging. I've got the code sample from factory.ino which shows voltage from IO4, but that doesn't help recognize if the board is plugged in or not. It also isn't a great indication of battery percentage left since it's nonlinear.

Does anyone have any example code on how to do this?

@mrudick1
Copy link
Author

Looking at the ESP32 doc, it looks like it's using GPIO19 for USB DM and GPIO20 for USB DP. If plugged into my laptop I get an analogRead of GPIO19 that's <5 with no serial data. When I use a charger/adapter to plug into and outlet, it looks like I get a steady reading of 4095 with or without a battery connected. Now, I don't know if this is a suitable solution of inferring that a 4095 analog reading means the T-QT Pro is plugged in and presumably charging.

Any and all feedback is appreciated!

@liangtongt
Copy link

where is the factory.ino? can you share it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants