Hi, I need help. In the code below I send commands to ESP32 and I can only send a new command if ESP32 responded with an OK. I have the "ast_NewText" event that returns the response from ESP32, but I don't know how to include it in "FOR". can anybody help me?
B4X:
Dim cursor1 As Cursor
cursor1 = SQL1.ExecQuery("SELECT linha FROM gcode order by numerador")
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
Dim linha As String = cursor1.GetString("linha")
ast.Write(linha & Chr(13))
'I need to wait for an OK return from ESP32 to send a new command. What can I put here to wait for OK?
Next
cursor1.Close