B4X:
Sub Timer1_Tick
If connected Then
If TextReader1.Ready Then 'check if there is any data waiting to be read
txt_chat.Text = txt_chat.Text & TextReader1.ReadLine & CRLF
txt_chat.SelectionStart = txt_chat.Text.Length
End If
End If
End Sub
I'm using the code below and it's working fine with ESP32, I'm talking to ESP32 and GRBL, sending command and getting OKs.
1) I just wanted to understand the reason for using a timer associated with sending messages.
2) Why the value of 200 milliseconds? Would it be a sufficient amount of waiting? If the response occurs before then, is the clock reset?
Could someone explain this dynamic to me?