I’m working on an embedded device that requires using AT commands to do settings and communicate with the board. So I hope to send several commands one by one and base on the response to determine what the next command will be sent out. For example,
send out “+++” to start AT command mode, if the feedback is “OK” then keep going, if the feedback is “(null) or something else” then resend “+++”.
I did find a discussion here, https://forum.xojo.com/12492-need-a-simple-serial-terminal
but it seems it’s too long ago and I can’t see the example by either using data available event or timer with serial.poll methods.
I also find something here, https://forum.xojo.com/16761-serial-rs232/0
@Jon Ogden provides a do…loop
Loop Until Serial1.LookAhead.Instr(Some_Response_I_Want) <> 0
Dim ReadString as String = Serial1.ReadAll[/code]
I tried but for some reason, I always get in the infinite loop and the GUI just hang.
I understand it’s not like in the embedded C programming, you can set a timer and send protocol one by one if something wrong just resends or throws out an interrupt or similar. So what’s the best way in Xojo to do the similar job?
If anyone could help I would appreciate that.