Hi Chris,
As Igor says, you can return from main(). Alternatively, you can call the C function exit(0); from anywhere.
For example:
#include "mbed.h"
DigitalOut led(LED1);
int main() {
led = 1;
exit(0); // exit OK
led = 0; // this will never happen
}
The exit() function (as with the main return value) considers an argument of 0 to be a success, and non-zero (e.g. 1) to indicate exiting with a failure. So, for example if you did the following, you'd get the BLOD (blue lights of death):
#include "mbed.h"
DigitalOut led(LED1);
int main() {
led = 1;
exit(1); // exit with an error
led = 0;
}
Hope that helps,
Simon
Hello,
I use an SdCard on my mbed, i would like to be sure that the program was perfectly finish when to user remove the SdCard from the connector.
What is the command or the function to "end" the program, after this function the user need to power-off/on or perform a reset to restart the LPC.
Thank you for your help.
Chris