Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
12 years, 11 months ago.
Question on wait() within a helper function
Hello, I just recently started using mbed, and I had a quick question.
If you use the wait() within a subfunction like the following example:
void hamster() {wait(5);}
int main() { while(1) { hamster(); wait(1); } }
would the main loop wait 5 seconds for the hamster() to finish before it waits 1 sec? Is the total delay of the while loop 6 seconds, or 1+minuscule sec, or exactly 1 sec?
Thanks for your time!
1 Answer
12 years, 11 months ago.
The total delay will be 6 seconds, it will wait until your function is finished.
If you dont want that, you can have a look at the RTOS library: http://mbed.org/handbook/RTOS