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:890055ba3680, 2010-10-09 (annotated)
- Committer:
- richmans
- Date:
- Sat Oct 09 11:13:13 2010 +0000
- Revision:
- 0:890055ba3680
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| richmans | 0:890055ba3680 | 1 | //Hello mbed world 1 |
| richmans | 0:890055ba3680 | 2 | #include "mbed.h" |
| richmans | 0:890055ba3680 | 3 | |
| richmans | 0:890055ba3680 | 4 | DigitalOut led1(LED1); |
| richmans | 0:890055ba3680 | 5 | DigitalOut led2(LED2); |
| richmans | 0:890055ba3680 | 6 | DigitalOut led3(LED3); |
| richmans | 0:890055ba3680 | 7 | DigitalOut led4(LED4); |
| richmans | 0:890055ba3680 | 8 | |
| richmans | 0:890055ba3680 | 9 | int main() { |
| richmans | 0:890055ba3680 | 10 | int currentLed = 0; |
| richmans | 0:890055ba3680 | 11 | while(1) { |
| richmans | 0:890055ba3680 | 12 | currentLed++; |
| richmans | 0:890055ba3680 | 13 | if (currentLed > 4) currentLed = 1; |
| richmans | 0:890055ba3680 | 14 | if (currentLed == 1) { |
| richmans | 0:890055ba3680 | 15 | led1 = 1; |
| richmans | 0:890055ba3680 | 16 | led4 = 0; |
| richmans | 0:890055ba3680 | 17 | }else if (currentLed == 2) { |
| richmans | 0:890055ba3680 | 18 | led2 = 1; |
| richmans | 0:890055ba3680 | 19 | led1 = 0; |
| richmans | 0:890055ba3680 | 20 | }else if (currentLed == 3) { |
| richmans | 0:890055ba3680 | 21 | led3 = 1; |
| richmans | 0:890055ba3680 | 22 | led2 = 0; |
| richmans | 0:890055ba3680 | 23 | }else if (currentLed == 4) { |
| richmans | 0:890055ba3680 | 24 | led4 = 1; |
| richmans | 0:890055ba3680 | 25 | led3 = 0; |
| richmans | 0:890055ba3680 | 26 | } |
| richmans | 0:890055ba3680 | 27 | |
| richmans | 0:890055ba3680 | 28 | wait(0.2); |
| richmans | 0:890055ba3680 | 29 | |
| richmans | 0:890055ba3680 | 30 | } |
| richmans | 0:890055ba3680 | 31 | } |