Hi Guys,
I am having a problem trying to receive serial data from B4R to my VB.Net program.
I either get nothing or something like 'Recieved???' or 0's.
But when I use the normal Arduino IDE and use:
Serial.println("Test');
It works 100% in my .Net program. In my .Net code I basically just do a Port.ReadLine call, which works for normal Serial.println. But even if I try Port.Read or Port.ReadByte for B4R I still get rubbish.
I use the following simple code in B4R:
What am I doing wrong here?
I am having a problem trying to receive serial data from B4R to my VB.Net program.
I either get nothing or something like 'Recieved???' or 0's.
But when I use the normal Arduino IDE and use:
Serial.println("Test');
It works 100% in my .Net program. In my .Net code I basically just do a Port.ReadLine call, which works for normal Serial.println. But even if I try Port.Read or Port.ReadByte for B4R I still get rubbish.
I use the following simple code in B4R:
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private SerialStream As AsyncStreams
Private Timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(9600)
SerialStream.Initialize(Serial1.Stream, "SerialStream_DataReceived", "SerialStream_Error")
Timer1.Initialize("Timer1_Tick", 1000)
Timer1.Enabled = True
End Sub
Sub Timer1_Tick
SerialStream.Write(Array As Byte("Test"))
End Sub
Sub SerialStream_DataReceived (Buffer() As Byte)
Log("Received: ", Buffer)
End Sub
Sub SerialStream_Error
Log("error")
End Sub
What am I doing wrong here?