Hello
I send data to with UPD from Ardunio to PC like under lines
sending data is HEX :E517C1029A02AE08
I double cheked with ardiuno logs with HAX data .
My hex data is inculde 4 uint values
E517 ->1. uint
C102->2. uint
9A02->3. uint
AE08->4. uint
After I recive with my PC (Java)
and I convert hex to int.
But valus not same with Ardunio uint values.
How can solve it?
I send data to with UPD from Ardunio to PC like under lines
sending data is HEX :E517C1029A02AE08
I double cheked with ardiuno logs with HAX data .
My hex data is inculde 4 uint values
E517 ->1. uint
C102->2. uint
9A02->3. uint
AE08->4. uint
B4X:
' *******THIS IS ARDIUNO CODE****************
rr=bc.HexFromBytes(Main.Read8(rn))
Log("sonuc:",rr) '>>> sonuc:E517C1029A02AE08
Dim bx(2),mr(8) As Byte
mr=Main.Read8(rn)
bc.ArrayCopy2(mr,0,bx,0,2)
Log(bc.UIntsFromBytes(bx)(0)) '>> 6117 (uint values)
bc.ArrayCopy2(mr,2,bx,0,2)
Log(bc.UIntsFromBytes(bx)(0))' >> 705 (uint values)
bc.ArrayCopy2(mr,4,bx,0,2)
Log(bc.UIntsFromBytes(bx)(0)) '>> 666 (uint values)
bc.ArrayCopy2(mr,6,bx,0,2)
Log(bc.UIntsFromBytes(bx)(0))'>>2222 (uint values)
After I recive with my PC (Java)
and I convert hex to int.
But valus not same with Ardunio uint values.
How can solve it?
B4X:
' *******THIS IS JAVA CODE on PC****************
Sub Cihaz_data_koundu_R10(no As Int,msg As String) 'ip port geldi
Log(msg) '>>> E517C1029A02AE08
Log(msg.Length) '>>>16
Dim sayi As Int
sayi=Bit.ParseInt(msg.SubString2(0,4),16)
Log(sayi) '>>>58647 (it is not same Arduino values =6117)
sayi=Bit.ParseInt(msg.SubString2(4,8),16)
Log(sayi) '>>>49410 (it is not sameArduino values =705)
sayi=Bit.ParseInt(msg.SubString2(8,12),16)
Log(sayi) '>>>39426 (it is not sameArduino values =666)
sayi=Bit.ParseInt(msg.SubString2(12,16),16)
Log(sayi) '>>>44552 (it is not sameArduino values =2222)
End Sub
Last edited: