T3.2 - USB detection?

Status
Not open for further replies.

danixdj

Well-known member
Hi, it's possible to know if the USB is connected or not to T3.2?
I hope that it's possible to know for make a specific code if is connected to the USB or by battery.
Thank u
Dan
 
If you edit the low-level USB code, you can detect whether the USB host has assigned an address and a configuration number.
 
I'm not sure it this would work, but couldn't you read the voltage on the USB 5v when an analogRead?
 
it’s perfect but is always true after the first plug of USB (computer, if it’s a power supply stay false).

It’s perfect but can’t recognise when is disconnected after the first connection..
 
You will have to roll your own solution. Another thing I can think of would be to set a timer that periodically sends date to the host. If the function returns 0 bytes sent, you could likely infer that the connection was lost.
 
I'm not sure it this would work, but couldn't you read the voltage on the USB 5v when an analogRead?

Depending on the Teensy, you would might need a voltage divider to bring the voltage down to 0..3.3v. You wouldn't need an analog read, a normal digital read would do.
 
Status
Not open for further replies.
Back
Top