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.
main.cpp@0:a5aeb2522cca, 2016-09-21 (annotated)
- Committer:
- oosattar
- Date:
- Wed Sep 21 10:51:03 2016 +0000
- Revision:
- 0:a5aeb2522cca
2
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| oosattar | 0:a5aeb2522cca | 1 | /**************************************************************** |
| oosattar | 0:a5aeb2522cca | 2 | / simple program to show basic program structure |
| oosattar | 0:a5aeb2522cca | 3 | / |
| oosattar | 0:a5aeb2522cca | 4 | / the program flashes onboard LED #1 on/off and a rate of 1Hz |
| oosattar | 0:a5aeb2522cca | 5 | / |
| oosattar | 0:a5aeb2522cca | 6 | *****************************************************************/ |
| oosattar | 0:a5aeb2522cca | 7 | |
| oosattar | 0:a5aeb2522cca | 8 | |
| oosattar | 0:a5aeb2522cca | 9 | |
| oosattar | 0:a5aeb2522cca | 10 | |
| oosattar | 0:a5aeb2522cca | 11 | #include "mbed.h" |
| oosattar | 0:a5aeb2522cca | 12 | |
| oosattar | 0:a5aeb2522cca | 13 | DigitalOut myled(LED1); |
| oosattar | 0:a5aeb2522cca | 14 | |
| oosattar | 0:a5aeb2522cca | 15 | int main() { |
| oosattar | 0:a5aeb2522cca | 16 | while(1) { //repeat indefinitly |
| oosattar | 0:a5aeb2522cca | 17 | uint8_t x = 0; //set start interger value as 0 |
| oosattar | 0:a5aeb2522cca | 18 | while(x < 5) { //while "x" interger value is less than 5 run rest of program |
| oosattar | 0:a5aeb2522cca | 19 | myled = 1; //turn on LED 1 |
| oosattar | 0:a5aeb2522cca | 20 | wait(1.0); //wait 1s |
| oosattar | 0:a5aeb2522cca | 21 | myled = 0; //turn LED 1 off |
| oosattar | 0:a5aeb2522cca | 22 | wait(1.0); //wait 1s |
| oosattar | 0:a5aeb2522cca | 23 | x= x + 1; //add 1 to "x" integer value |
| oosattar | 0:a5aeb2522cca | 24 | } |
| oosattar | 0:a5aeb2522cca | 25 | wait(5.0); //wait 5s |
| oosattar | 0:a5aeb2522cca | 26 | } |
| oosattar | 0:a5aeb2522cca | 27 | } |