Suchakhree Srisukprom
/
Test_Megre
k
Diff: GetDistance2LED.cpp
- Revision:
- 0:238df339023b
- Child:
- 1:426fbd0d126a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GetDistance2LED.cpp Mon Dec 07 12:20:46 2015 +0000 @@ -0,0 +1,39 @@ + +//Function 4 getdistance2led + +/*DigitalOut pinled0(PC_3); DigitalOut pinled1(PC_2); DigitalOut pinled2(PH_1); +DigitalOut pinled3(PH_0); DigitalOut pinled4(PC_15); DigitalOut pinled5(PC_14); +DigitalOut pinled6(PC_13); DigitalOut pinled7(PB_7); DigitalOut pinled8(PA_15); +DigitalOut pinled9(PA_14); DigitalOut pinbuzz(PA_13); + +void getdistance2led(char step) +{ + resetled(); + if(step == '0'){ + pinled0=1; pinled1=0; pinled2=0; pinled3=0; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '1'){ + pinled0=1; pinled1=1; pinled2=0; pinled3=0; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '2'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=0; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '3'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=0; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '4'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '5'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=0; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '6'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=0; pinled8=0; pinled9=0;} + else if(step == '7'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=1; pinled8=0; pinled9=0; pinbuzz=1;} + else if(step == '8'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=1; pinled8=1; pinled9=0; pinbuzz=1;} + else if(step == '9'){ + pinled0=1; pinled1=1; pinled2=1; pinled3=1; pinled4=1; pinled5=1; pinled6=1; pinled7=1; pinled8=1; pinled9=1; pinbuzz=1;} +} +void resetled() +{ + //reset + pinled0=0; pinled1=0; pinled2=0; pinled3=0; pinled4=0; + pinled5=0; pinled6=0; pinled7=0; pinled8=0; pinled9=0; + pinbuzz=0; +}*/ \ No newline at end of file