hi everyone
i'm new B4A, I want connect my tablet android with my arduino board
i find a FelUSBSerial libray and use it,it worked , but i have 1 problem: My arduino board send 1 number increase, my tablet receive a number with "3" in top
my arduino code is
and my b4a code is
when arduino send "1", tablet receive "31"
when arduino send "15, tablet receive "315"
i can slipt the string, but i don't want do that, please help me how can i receive
exactly what arduino send.
thank you very much
i'm new B4A, I want connect my tablet android with my arduino board
i find a FelUSBSerial libray and use it,it worked , but i have 1 problem: My arduino board send 1 number increase, my tablet receive a number with "3" in top
my arduino code is
B4X:
unsigned int a = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print(a);
delay(1000);
a++;
}
B4X:
Private Sub serial_DataAvailable (Buffer() As Byte)
LblReceive.Text=""
LblReceive.Text= bc.StringFromBytes(Buffer,"UTF8")
'Log("New data: " & Buffer)
End Sub
Sub BtnDisConnect_Click
End Sub
Sub BtnConnect_Click
If manager.GetDevices.Length = 0 Then
Log("No connected usb devices.")
Else
Dim device As UsbDevice = manager.GetDevices(0) 'assuming that there is exactly one device
If manager.HasPermission(device) = False Then
ToastMessageShow("Please allow connection and click again.", True)
manager.RequestPermission(device)
Else
usb_Serial.Initialize2("serial", device, -1,"CH34xSerialDevice")
usb_Serial.BaudRate = 115200
usb_Serial.DataBits = usb_Serial.DATA_BITS_8
usb_Serial.StartReading
End If
End If
End Sub
when arduino send "15, tablet receive "315"
i can slipt the string, but i don't want do that, please help me how can i receive
exactly what arduino send.
thank you very much