AnsweredAssumed Answered

Is there a way to run a while() loop for a limited time only, and then break away from it?

Question asked by Guest on Apr 13, 2009
Latest reply on Apr 14, 2009 by Guest

Hi. I'm familiar with the operation of the while() loop. I would like to know if it is possible to run a while() loop for only a few seconds (3 seconds for example), and then break away from it and go down to the next instruction? 


For example, in the code below:

while (sensor_value > 55)


      ........ //operation here




Is it possible for the program to run the while() loop for only 3 seconds, and then breaks away from it regardless of the sensor_value, and goes down straight to the motor_stop() function?



Message Edited by Cryptical on 2009-04-13 10:37 AM