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:dd5538520165, 2016-09-22 (annotated)
- Committer:
- cwardlaw
- Date:
- Thu Sep 22 14:50:57 2016 +0000
- Revision:
- 0:dd5538520165
The program flashes onboard LED #1 on/off at a rate of 2Hz
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cwardlaw | 0:dd5538520165 | 1 | /************************************************************** |
| cwardlaw | 0:dd5538520165 | 2 | / Simple program program to show basic program structure |
| cwardlaw | 0:dd5538520165 | 3 | / |
| cwardlaw | 0:dd5538520165 | 4 | / The program flashes onboard LED #1 on/off at a rate of 2Hz |
| cwardlaw | 0:dd5538520165 | 5 | / |
| cwardlaw | 0:dd5538520165 | 6 | /**************************************************************/ |
| cwardlaw | 0:dd5538520165 | 7 | |
| cwardlaw | 0:dd5538520165 | 8 | #include "mbed.h" |
| cwardlaw | 0:dd5538520165 | 9 | |
| cwardlaw | 0:dd5538520165 | 10 | DigitalOut myled(LED1); // use onboard LED #1 |
| cwardlaw | 0:dd5538520165 | 11 | int main() { |
| cwardlaw | 0:dd5538520165 | 12 | while(1) { // repeat indefinitely |
| cwardlaw | 0:dd5538520165 | 13 | myled = 1; // turn on LED #1 |
| cwardlaw | 0:dd5538520165 | 14 | wait(0.250); // wait 250ms |
| cwardlaw | 0:dd5538520165 | 15 | myled = 0; // turn off LED #1 |
| cwardlaw | 0:dd5538520165 | 16 | wait(0.250); // wait 250ms |
| cwardlaw | 0:dd5538520165 | 17 | } |
| cwardlaw | 0:dd5538520165 | 18 | } |