9 years, 10 months ago.

Doing an action for a specific time

I got a Problem. in my program I want to make a specific Action for 2 sec. but I cannot use the wait command since during the time, the code should continue in this time, but just make a specific type of code.

Can anyone help me? If it not good enough described, just tell me :) Greeings

2 Answers

9 years, 10 months ago.

Hello,I think these references may help you:

http://mbed.org/handbook/Ticker

http://mbed.org/handbook/Timeout

9 years, 10 months ago.

Your description of your problem is not good enough.

But if you want something to happen two seconds after running some code, a timeout interrupt function would be the way to go.

If you want to do something for two seconds, then I'm not exactly sure what you mean. If you want to run a loop for two seconds, use a timer and check if the timer is equal to or greater than 2 every time the loop runs.