11 years, 2 months ago.

How can i pause or stop a program while running?

I am newbie in mbed technology. Currently i am running a program but i can not pause or stop it while running and power line plugged in. How can i stop i program while running?

3 Answers

11 years, 2 months ago.

Hi, for making a pause in a program you may use the wait functions:

http://mbed.org/handbook/Wait You also may try Thread::wait function

About stopping the program, generally it have a infinite loop (while(1)). The only thing you have to do is use the break function to exit the loop

I hope this information was helpful

Greetings

11 years, 2 months ago.

You could set up a serial connection with a terminal and then use getc() which will stop the program until a key is pressed?

11 years, 2 months ago.

You could set up a I/O pin to respond to a interrupt and connect a button there. see http://mbed.org/handbook/InterruptIn Something usefull could be .. one press on the button and the program stops and a led turns on ..another press on the button makes the program run ( from the point where was stopped) and the led turns off.