Sub btnSend_Click
AStream.Write(txtInput.Text.GetBytes("UTF8"))
txtInput.SelectAll
txtInput.RequestFocus
LogMessage("Me", txtInput.Text)
End Sub
Hi rfsingh81,
try to increase the delay in the MCU firmware.
Main:
Debugin [DEC B0]
if b0=4 then GoSub TOG ; led 1 toggles
if b0=5 then GoSub DOG ; led 2 toggles
Pause 200
Goto Main
To send a fixed character as a string or decimal. Lets say for example send an String "a" or decimal equivalent of "a".AStream.Write(txtInput.Text.GetBytes("UTF8"))
Thanks M8 for the appreciation.Rfsingh81,
You have made an important discovery! The representation of data is fundamental to handling it. You will find different computer languages often handle data types differently. By learning the details, you are well on the way, if not already, to be a great programmer.
Cheers!
Main:
Debugin [Wait(1), B0]
if b0=4 then GoSub TOG ; led 1 toggles
if b0=5 then GoSub DOG ; led 2 toggles
Pause 200
Goto Main
debug "a" // Send 'a' as a string
Sub AStream_NewData (Buffer() As Byte)
ToastMessageShow(BytesToString(Buffer, 0, Buffer.Length, "UTF8"),True)
' LoadMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
End Sub
Prefix mode can only work if both sides of the connection adhere to the protocol.Many experience problems using prefix mode without setting length in first 32 bits.
Many experience problems using prefix mode without setting length in first 32 bits. The solution is non prefix mode. There are many posts on this. The system hangs because the "a" is interpreted as a length, and receive waits for more.
AStream.InitializePrefix(Main.serial1.InputStream, False, Main.serial1.OutputStream, "AStream")
set a Boolean variable (flag), to see for new data before trying to act on them.
Sub AStream_NewData (Buffer() As Byte)
ToastMessageShow(BytesToString( Buffer, 0, Buffer.Length, "UTF8"),True)
' LoadMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?