Watch 3 Star 1 Fork 3

idea4good / GuiLiteSamplesC++Apache-2.0

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
Clone or download
Serial.md 2.02 KB
Copy Edit Web IDE Raw Blame History
idea4good authored 2020-02-02 23:19 . upload code

How to use serial with Android phone?

With the help of serial calbe, you can connect external device with Android phone. In this case, the external device is PC.

Prerequisite

In order to tranform USB singal of Android phone to serial signal, you need some hardware here.

Android phone with micro USB port(support OTG)

OTG to UART bridge(手机USB转串口TTL适配器) -- CP210x-Silicon Labs will be recommended.

Or Android phone with type-c USB port

  1. Type-c to USB adapter.
  2. USB to UART bridge -- CP210x-Silicon Labs will be recommended.
  3. Connet 1 & 2, you got a type-c to UART bridge.

PC side

USB to UART bridge

Note: UART has TTL/RS232 types, choose one of them to use

How to connect?

Connect them like this: connect

Send data on PC

Run serial tool on PC like this:

pc-side

Send wave data:

7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7E 7E 7F 81 81 82 82 83 84 84 84 84 83 82 82 81 81 7F 7F 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7C 7B 7A 79 7A 82 89 91 98 9F A2 9B 94 8C 85 7E 78 79 7A 7B 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7D 7E 7F 7F 81 81 82 83 84 84 85 86 87 87 87 88 88 89 89 89 8A 8A 8A 8A 89 89 88 88 87 87 85 85 85 83 82 81 81 7F 7E 7E 7D 7D 7D 7D 7D 7D 7D 7D 7D

Receive data on Android phone

Double click APP(source code), it will connect USB serial automaticlly. You will see this if everything is ok:

UsbConnected

Links

Demo video

Source code

Comment ( 0 )

Sign in for post a comment

C++
1
https://gitee.com/idea4good/GuiLiteSamples.git
git@gitee.com:idea4good/GuiLiteSamples.git
idea4good
GuiLiteSamples
GuiLiteSamples
master

Help Search