Suchakhree Srisukprom
/
Test_Megre
k
GetDistance2LED.cpp@1:426fbd0d126a, 2015-12-09 (annotated)
- Committer:
- Suchakhree
- Date:
- Wed Dec 09 10:19:11 2015 +0000
- Revision:
- 1:426fbd0d126a
- Parent:
- 0:238df339023b
????????????????? ????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Suchakhree | 0:238df339023b | 1 | |
Suchakhree | 0:238df339023b | 2 | //Function 4 getdistance2led |
Suchakhree | 0:238df339023b | 3 | |
Suchakhree | 1:426fbd0d126a | 4 | /*DigitalOut pinled0(PC_8); DigitalOut pinled1(PC_6); DigitalOut pinled2(PC_5); |
Suchakhree | 1:426fbd0d126a | 5 | DigitalOut pinled3(PA_12); DigitalOut pinled4(PA_11); DigitalOut pinled5(PB_12); |
Suchakhree | 1:426fbd0d126a | 6 | DigitalOut pinled6(PB_2); DigitalOut pinled7(PB_15); DigitalOut pinled8(PB_14); |
Suchakhree | 1:426fbd0d126a | 7 | DigitalOut pinled9(PB_13); DigitalOut pinbuzz(D3); |
Suchakhree | 0:238df339023b | 8 | |
Suchakhree | 0:238df339023b | 9 | void getdistance2led(char step) |
Suchakhree | 0:238df339023b | 10 | { |
Suchakhree | 0:238df339023b | 11 | resetled(); |
Suchakhree | 0:238df339023b | 12 | if(step == '0'){ |
Suchakhree | 0:238df339023b | 13 | pinled0=1; pinled1=0; pinled2=0; pinled3=0; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 14 | else if(step == '1'){ |
Suchakhree | 0:238df339023b | 15 | pinled0=1; pinled1=1; pinled2=0; pinled3=0; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 16 | else if(step == '2'){ |
Suchakhree | 0:238df339023b | 17 | pinled0=1; pinled1=1; pinled2=1; pinled3=0; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 18 | else if(step == '3'){ |
Suchakhree | 0:238df339023b | 19 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 20 | else if(step == '4'){ |
Suchakhree | 0:238df339023b | 21 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 22 | else if(step == '5'){ |
Suchakhree | 0:238df339023b | 23 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 24 | else if(step == '6'){ |
Suchakhree | 0:238df339023b | 25 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=0; pinled8=0; pinled9=0;} |
Suchakhree | 0:238df339023b | 26 | else if(step == '7'){ |
Suchakhree | 0:238df339023b | 27 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=1; pinled8=0; pinled9=0; pinbuzz=1;} |
Suchakhree | 0:238df339023b | 28 | else if(step == '8'){ |
Suchakhree | 0:238df339023b | 29 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=1; pinled8=1; pinled9=0; pinbuzz=1;} |
Suchakhree | 0:238df339023b | 30 | else if(step == '9'){ |
Suchakhree | 0:238df339023b | 31 | pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=1; pinled8=1; pinled9=1; pinbuzz=1;} |
Suchakhree | 0:238df339023b | 32 | } |
Suchakhree | 0:238df339023b | 33 | void resetled() |
Suchakhree | 0:238df339023b | 34 | { |
Suchakhree | 0:238df339023b | 35 | //reset |
Suchakhree | 0:238df339023b | 36 | pinled0=0; pinled1=0; pinled2=0; pinled3=0; pinled4=0; |
Suchakhree | 0:238df339023b | 37 | pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0; |
Suchakhree | 0:238df339023b | 38 | pinbuzz=0; |
Suchakhree | 0:238df339023b | 39 | }*/ |