Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 1:9f6f3af9aaaa
- Parent:
- 0:293359e38af0
- Child:
- 2:1f9267d3f3f4
--- a/main.cpp Sat Aug 12 19:40:37 2017 +0000 +++ b/main.cpp Wed Sep 13 18:59:14 2017 +0000 @@ -4,19 +4,14 @@ This example code is in the public domain. */ - // #include is a directive that "pastes" a file into your code. // Use this specific #include at the beginning of each mbed program. // mbed.h contains/points to the full definitions of our simple statements. - #include "mbed.h" - // Define the object board_LED to be a digital output connected to LED1, -// which is the little green LED on the Nucleo board. - +// which is the little green LED built into the Nucleo board. DigitalOut board_LED(LED1); - -/* The "main" function defines your main program--it executes as soon as +/* The "main" function defines your main program -- it executes as soon as you program the board. Functions can return (compute and give back) a value. The main function @@ -24,21 +19,16 @@ Functions can also accept inputs. The main function cannot however, so its round parentheses are empty. -*/ - +*/ int main() { // This curly brace marks the beginning of the main function. - // while() will repeat a set of actions as long as the statement inside - // its round parentheses is true. 1 is the definition of true, so - // while(1) repeats forever. - - while(1) { // This curly brace marks the beginning of the repeated actions. + // its round parentheses is true. 1 is the definition of true, so + // while(1) and while(true) repeat forever. + while(true) { // This curly brace marks the start of the repeated actions. board_LED = 1; // Turn on LED by storing a 1 in board_LED. - wait(0.5); // wait() will pause for a given number of seconds. + wait(0.5); // wait(x) will pause for a given number of seconds. board_LED = 0; // Turn off LED by storing a 0 in board_LED. wait(0.5); // wait another 1/2 second. - - } // end of repeated actions - + } // end of repeated actions } // end of main function \ No newline at end of file