Suchakhree Srisukprom
/
Test_Megre
k
Diff: Getswitch2Send.cpp
- Revision:
- 1:426fbd0d126a
- Parent:
- 0:238df339023b
--- a/Getswitch2Send.cpp Mon Dec 07 12:20:46 2015 +0000 +++ b/Getswitch2Send.cpp Wed Dec 09 10:19:11 2015 +0000 @@ -1,10 +1,35 @@ - -/*DigitalIn switch1(D5); -DigitalIn switch2(D6); -DigitalIn switch3(D7); +/* +//Setup +InterruptIn switch1(D11); +InterruptIn switch2(D10); +InterruptIn switch3(D7); +void switch1(); +void switch2(); +void switch3(); +int matrix_state=0; - if(switch1==1) pc.printf("#TR$"); - if(switch2==1) pc.printf("#TL$"); - if(switch3==1) pc.printf("#BR$"); - else pc.printf("#MED$"); - */ \ No newline at end of file + + // int main() + switch1.rise(&switch_1); + switch2.rise(&switch_2); + switch3.rise(&switch_3); + if(matrix_state == 0){mobile.printf("#MED$"); pc.printf("#MED$");} + else if(matrix_state == 1){mobile.printf("#TR$"); pc.printf("#TR$\n");} + else if(matrix_state == 2){mobile.printf("#TL$"); pc.printf("#TL$\n");} + else if(matrix_state == 3){mobile.printf("#BR$"); pc.printf("#BR$\n");} + if(switch1 == 0 && switch2 == 0 & switch3 == 0 ) matrix_state = 0; + +//Function +void switch_1() +{ + matrix_state=1; +} +void switch_2() +{ + matrix_state=2; +} +void switch_3() +{ + matrix_state=3; +}*/ + \ No newline at end of file