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:ffa3929949f3, 2011-05-21 (annotated)
- Committer:
- jksoft
- Date:
- Sat May 21 07:30:27 2011 +0000
- Revision:
- 0:ffa3929949f3
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jksoft | 0:ffa3929949f3 | 1 | #include "mbed.h" |
| jksoft | 0:ffa3929949f3 | 2 | |
| jksoft | 0:ffa3929949f3 | 3 | DigitalOut led1(LED1); |
| jksoft | 0:ffa3929949f3 | 4 | DigitalOut led2(LED2); |
| jksoft | 0:ffa3929949f3 | 5 | DigitalOut led3(LED3); |
| jksoft | 0:ffa3929949f3 | 6 | DigitalOut led4(LED4); |
| jksoft | 0:ffa3929949f3 | 7 | Serial pc(USBTX, USBRX); |
| jksoft | 0:ffa3929949f3 | 8 | |
| jksoft | 0:ffa3929949f3 | 9 | int main() { |
| jksoft | 0:ffa3929949f3 | 10 | char ch; |
| jksoft | 0:ffa3929949f3 | 11 | |
| jksoft | 0:ffa3929949f3 | 12 | while(1) { |
| jksoft | 0:ffa3929949f3 | 13 | |
| jksoft | 0:ffa3929949f3 | 14 | pc.printf("Push 1-4 Key->"); |
| jksoft | 0:ffa3929949f3 | 15 | ch = pc.getc(); |
| jksoft | 0:ffa3929949f3 | 16 | pc.printf("%c¥r¥n",ch); |
| jksoft | 0:ffa3929949f3 | 17 | |
| jksoft | 0:ffa3929949f3 | 18 | switch(ch) |
| jksoft | 0:ffa3929949f3 | 19 | { |
| jksoft | 0:ffa3929949f3 | 20 | case '1': |
| jksoft | 0:ffa3929949f3 | 21 | led1 =! led1; |
| jksoft | 0:ffa3929949f3 | 22 | break; |
| jksoft | 0:ffa3929949f3 | 23 | case '2': |
| jksoft | 0:ffa3929949f3 | 24 | led2 =! led2; |
| jksoft | 0:ffa3929949f3 | 25 | break; |
| jksoft | 0:ffa3929949f3 | 26 | case '3': |
| jksoft | 0:ffa3929949f3 | 27 | led3 =! led3; |
| jksoft | 0:ffa3929949f3 | 28 | break; |
| jksoft | 0:ffa3929949f3 | 29 | case '4': |
| jksoft | 0:ffa3929949f3 | 30 | led4 =! led4; |
| jksoft | 0:ffa3929949f3 | 31 | break; |
| jksoft | 0:ffa3929949f3 | 32 | default: |
| jksoft | 0:ffa3929949f3 | 33 | pc.printf("Please push the key to 1-4.¥r¥n"); |
| jksoft | 0:ffa3929949f3 | 34 | break; |
| jksoft | 0:ffa3929949f3 | 35 | } |
| jksoft | 0:ffa3929949f3 | 36 | } |
| jksoft | 0:ffa3929949f3 | 37 | } |