I have not had much success using WaitFor
At the moment, I want to use it to trap either one of two boolean flags after I send a command via AStream.
One flag is set when I received a message via AStream_NewData the other is set in a TimeOutTimer_Tick event if the command times out.
So I would like to use something like this:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Obviously that syntax does not work but it gives you the idea. I do not know how to formulate it.
At the moment, I just have a Do While loop with Sleep(0) and that works but that is not very elegant when WaitFor is right there seemingly intended to fix just that....
			
			At the moment, I want to use it to trap either one of two boolean flags after I send a command via AStream.
One flag is set when I received a message via AStream_NewData the other is set in a TimeOutTimer_Tick event if the command times out.
So I would like to use something like this:
			
				B4X:
			
		
		
		WaitFor( DataReceived = True Or TimedOut = True )
	At the moment, I just have a Do While loop with Sleep(0) and that works but that is not very elegant when WaitFor is right there seemingly intended to fix just that....