jacklinquan / usbserial4a

Python package for Android USB host serial port.
MIT License
60 stars 17 forks source link

Send Integer From Android to Arduino Serially #13

Closed gepetto82 closed 1 year ago

gepetto82 commented 1 year ago

How can I use the

serial_port.write(b'Hello world!')

Command given at the end of the example.py document to send an integer from android device to arduino?

jacklinquan commented 1 year ago

Serial communication sends all kinds of data in sequence of bytes. The sending and receiving devices must agree on how these bytes are packed and unpacked. In your code, you can do this by using struct.pack and struct.unpack.

jacklinquan commented 1 year ago

Since this is not a real issue, I will close it in 24 hours.