Android Question How to get integer number vi serial communication

avnersh

Member
Licensed User
Longtime User
Hello
I'm using felUsbSerial - Usb Serial library to get intger numbers from
arduino to android (b4a). My problem is that the integers translated to byte vi the serial usb. becuase my project deal with sampling sensor buy arduino I need an effective and fast way to get back my lost integers number.
I will Appreciate any Proposal
thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Simplest way is to program the Arduino with B4R and use B4RSerializator + AsyncStreams.
https://www.b4x.com/android/forum/threads/72404/#content

Data is always sent as bytes. You can use ByteCovnerter or RandomAccessFile to convert the bytes back to integers. Note that Arduino integers are actually 16 bit numbers which match B4A shorts.
 
Upvote 0
Top