Android USB API: Switch between charge and data send
Asked Answered
V

2

7

I'm starting to use the Android USB API to send data from an Arduino to an Android device. Is it possible to programmatically switch between send/receive data and just charge the Android phone?

I know that you cannot do both things at the same time, and, since you have to open a FileInputStream in order to be able to receive data, as long as this is open the device won't be charged.

Will it be just as simple as closing this stream to charge again? If is as simple as it, can the Arduino then send basic information in order to ask the device to open the stream again?

Virginavirginal answered 2/11, 2012 at 17:34 Comment(0)
L
0

First of all, so that you can communicate with with other devices with your Android device you have to use an OTG cable or adapter, which already predisposes the device so that it is in communication mode, also the Android USB api is already provided for this and you you have no need to manipulate this because the change of automatic

Ledaledah answered 1/10, 2020 at 22:23 Comment(0)
L
0

Even though the question is extremely old, I would like to answer for new people that are going to see this post.

So 80 % of embedded boards like Raspberry, Arduino, Teensy etc. have a USB port that both power the device and can be used for data transmission; for the rest of the boards, you usually have to attach an external power supply while uploading the data via USB.

Lists answered 18/8 at 15:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.