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.
Dependencies: mbed
main.cpp@3:2ffb7f153526, 2015-10-20 (annotated)
- Committer:
- kantapon501
- Date:
- Tue Oct 20 07:46:05 2015 +0000
- Revision:
- 3:2ffb7f153526
- Parent:
- 2:e9a626e1b717
- Child:
- 4:21ddb5cfccdf
Lab03;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kantapon501 | 0:408ece0a3217 | 1 | #include "mbed.h" |
| kantapon501 | 0:408ece0a3217 | 2 | |
| kantapon501 | 0:408ece0a3217 | 3 | DigitalOut Out1(D13); |
| kantapon501 | 0:408ece0a3217 | 4 | DigitalOut Out2(D12); |
| kantapon501 | 0:408ece0a3217 | 5 | DigitalOut Out3(D11); |
| kantapon501 | 0:408ece0a3217 | 6 | DigitalOut Out4(D10); |
| kantapon501 | 0:408ece0a3217 | 7 | DigitalOut Out5(D9); |
| kantapon501 | 0:408ece0a3217 | 8 | DigitalOut Out6(D8); |
| kantapon501 | 0:408ece0a3217 | 9 | DigitalOut Out7(D7); |
| kantapon501 | 0:408ece0a3217 | 10 | DigitalOut Out8(D6); |
| kantapon501 | 0:408ece0a3217 | 11 | |
| kantapon501 | 0:408ece0a3217 | 12 | DigitalIn In1(D0); |
| kantapon501 | 0:408ece0a3217 | 13 | |
| kantapon501 | 0:408ece0a3217 | 14 | Serial pc(SERIAL_TX, SERIAL_RX); |
| kantapon501 | 0:408ece0a3217 | 15 | |
| kantapon501 | 0:408ece0a3217 | 16 | int main() |
| kantapon501 | 0:408ece0a3217 | 17 | { |
| kantapon501 | 1:0422677b0ccc | 18 | uint8_t menu_0=0; |
| kantapon501 | 3:2ffb7f153526 | 19 | uint8_t menu_1=0; |
| kantapon501 | 3:2ffb7f153526 | 20 | uint8_t select_0=0; |
| kantapon501 | 3:2ffb7f153526 | 21 | uint8_t select_1=0; |
| kantapon501 | 0:408ece0a3217 | 22 | |
| kantapon501 | 1:0422677b0ccc | 23 | pc.printf("Hello Sir !!\n"); |
| kantapon501 | 0:408ece0a3217 | 24 | while(1) |
| kantapon501 | 0:408ece0a3217 | 25 | { |
| kantapon501 | 1:0422677b0ccc | 26 | if(menu_0 == 0) |
| kantapon501 | 0:408ece0a3217 | 27 | { |
| kantapon501 | 1:0422677b0ccc | 28 | pc.printf("Plese select your menu\n"); |
| kantapon501 | 1:0422677b0ccc | 29 | pc.printf("Input 1 for Menu1\n"); |
| kantapon501 | 1:0422677b0ccc | 30 | pc.printf("Input 2 for Menu2\n"); |
| kantapon501 | 1:0422677b0ccc | 31 | menu_0 = 1; |
| kantapon501 | 0:408ece0a3217 | 32 | } |
| kantapon501 | 1:0422677b0ccc | 33 | if(pc.readable()) |
| kantapon501 | 0:408ece0a3217 | 34 | { |
| kantapon501 | 0:408ece0a3217 | 35 | select_0 = pc.getc(); |
| kantapon501 | 1:0422677b0ccc | 36 | pc.printf("\n"); |
| kantapon501 | 1:0422677b0ccc | 37 | menu_0 = 0; |
| kantapon501 | 1:0422677b0ccc | 38 | switch(select_0) |
| kantapon501 | 0:408ece0a3217 | 39 | { |
| mustwillza | 2:e9a626e1b717 | 40 | case('1'): |
| kantapon501 | 3:2ffb7f153526 | 41 | while(1) |
| kantapon501 | 3:2ffb7f153526 | 42 | { |
| kantapon501 | 3:2ffb7f153526 | 43 | if(menu_1==0) |
| kantapon501 | 3:2ffb7f153526 | 44 | { |
| kantapon501 | 3:2ffb7f153526 | 45 | pc.printf("Input 1 for Pattern1\n"); |
| kantapon501 | 3:2ffb7f153526 | 46 | pc.printf("Input 2 for Pattern2\n"); |
| kantapon501 | 3:2ffb7f153526 | 47 | pc.printf("Input 3 for Exit"); |
| kantapon501 | 3:2ffb7f153526 | 48 | menu_1 = 1; |
| kantapon501 | 3:2ffb7f153526 | 49 | } |
| kantapon501 | 3:2ffb7f153526 | 50 | if(pc.readable()) |
| kantapon501 | 3:2ffb7f153526 | 51 | { |
| kantapon501 | 3:2ffb7f153526 | 52 | select_1 = pc.getc(); |
| kantapon501 | 3:2ffb7f153526 | 53 | pc.printf("\n"); |
| kantapon501 | 3:2ffb7f153526 | 54 | menu_1 = 0; |
| kantapon501 | 3:2ffb7f153526 | 55 | switch(select_1) |
| kantapon501 | 3:2ffb7f153526 | 56 | { |
| kantapon501 | 3:2ffb7f153526 | 57 | case('1'): pc.printf("Pattern1\n"); break; |
| kantapon501 | 3:2ffb7f153526 | 58 | |
| kantapon501 | 3:2ffb7f153526 | 59 | case('2'): pc.printf("Pattern2\n");break; |
| kantapon501 | 3:2ffb7f153526 | 60 | |
| kantapon501 | 3:2ffb7f153526 | 61 | case('3'): break; |
| kantapon501 | 3:2ffb7f153526 | 62 | } |
| kantapon501 | 3:2ffb7f153526 | 63 | } |
| kantapon501 | 3:2ffb7f153526 | 64 | } |
| mustwillza | 2:e9a626e1b717 | 65 | case('2'): |
| mustwillza | 2:e9a626e1b717 | 66 | pc.printf("Read Status\n"); |
| mustwillza | 2:e9a626e1b717 | 67 | break; |
| kantapon501 | 0:408ece0a3217 | 68 | } |
| kantapon501 | 1:0422677b0ccc | 69 | } |
| kantapon501 | 1:0422677b0ccc | 70 | } |
| kantapon501 | 0:408ece0a3217 | 71 | } |
| kantapon501 | 0:408ece0a3217 | 72 |