Hi
Sending strings to a RF-Link on an Arduino Mega from a B4J program. Works ok but get strange serial error :
Sending 10;NewKaku;0129abf6;10;OFF from MLS --> Serial OK
But when sending :
Sending 10;NewKaku;0129abf6;f;ON to Serial FAILED
(NumberFormatException) java.lang.NumberFormatException: For input string: "e"
Why is not both '10' and 'e' considered to be a string in serial ?
Any help appreciated
Regards Håkan
Sending strings to a RF-Link on an Arduino Mega from a B4J program. Works ok but get strange serial error :
Sending 10;NewKaku;0129abf6;10;OFF from MLS --> Serial OK
But when sending :
Sending 10;NewKaku;0129abf6;f;ON to Serial FAILED
(NumberFormatException) java.lang.NumberFormatException: For input string: "e"
Why is not both '10' and 'e' considered to be a string in serial ?
B4X:
'###################################################################################
'########### Send commands from MLServer to Serial(RF) OR Gateway ##################
'###################################################################################
Sub TcpStreams_NewText(Text As String)'data from MLS (port 20000)
'split cmd
Dim A() As String = Regex.Split(";", s.Mid(Text,2,s.Len(Text)-1))'remove $
Log(A(1) & " " & A(2) & " " & A(3) & " " & A(4))
'update LOG
Ser_text.Text = Ser_text.Text & Text & Chr(13) & Chr(10)
' Ser_text.ScrollTopPosition = Ser_text.Text.Length
Ser_text.SetSelection(Ser_text.Text.Length, Ser_text.Text.Length)
'CHECK If COMMND To BE RUN ON GATEWAY OR TO BE SENT TO SERIAL
Select Case s.mid(Text,1,1)
Case "#" ' cmd from MLS not to be sent to serial
Log("MLS --> Gateway")
eval_MLSCMD(s.Mid(Text,2,s.Len(Text)-1))
Case Else
Try
update_switchStatus(A(1),A(2),A(3),A(4),"","")
ast.Write (s.Trim(Text) & Chr(13) & Chr(10))
Log("Sending " & Text & " from MLS --> Serial OK")
Log("Updating_switchStatus")
' update_switchStatus(A(1),A(2),A(3),A(4),"","")
Catch
Log("Sending " & Text & " to Serial FAILED")
Log(LastException)
End Try
End Select
End Sub
Any help appreciated
Regards Håkan