six sensors
Dependencies: MotorDriver_SU mbed
Fork of finalcenter by
Revision 2:744aaae91c45, committed 2014-11-24
- Comitter:
- 12F2041G
- Date:
- Mon Nov 24 06:48:35 2014 +0000
- Parent:
- 1:0cd50a576350
- Commit message:
- 1124
Changed in this revision
center.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0cd50a576350 -r 744aaae91c45 center.cpp --- a/center.cpp Sun Nov 23 09:08:39 2014 +0000 +++ b/center.cpp Mon Nov 24 06:48:35 2014 +0000 @@ -8,7 +8,9 @@ DigitalIn sensor3(P0_11); // lift L to R DigitalIn sensor4(P0_21); +DigitalIn sensor6(Px_xx); DigitalIn sensor5(P0_22); +DigitalIn sensor7(Px_xx); DigitalOut led(P1_28); @@ -40,7 +42,7 @@ motor.Drive(1, CW, 1700); lift.Drive(0, STOP, 0); } - else if(sensor1 == 1 && sensor2 == 0 && sensor3 == 1 && sensor4 == 0 && sensor5 == 0){ + else if((sensor1 == 1 && sensor2 == 0 && sensor3 == 1 && sensor4 == 0 && sensor5 == 0)||(sensor1 == 1 && sensor2 == 0 && sensor3 == 1 && sensor4 == 0 && sensor7 == 0)||(sensor1 == 1 && sensor2 == 0 && sensor3 == 1 && sensor6 == 0 && sensor5 == 0)||(sensor1 == 1 && sensor2 == 0 && sensor3 == 1 && sensor5 == 0 && sensor7 == 0)){ led = 1;//count kakuninn if( count == 0){ lift.Drive(0, CW, 4095); //lift up @@ -108,7 +110,7 @@ lift.Drive(0, STOP, 0); } //select course condition - else if(sensor2 == 0 && sensor4 == 1 && sensor5 == 0){ + else if((sensor2 == 0 && sensor4 == 1 && sensor5 == 0)||(sensor2 == 0 && sensor4 == 1 && sensor7 == 0 )||(sensor2 == 0 && sensor6 == 1 && sensor5 == 0)||(sensor2 == 0 && sensor6 == 1 && sensor7 == 0)){ if(check1 == 0){ check1 = 1; motor.Drive(0, CW, 1000);//adjust @@ -123,7 +125,7 @@ ;//response only once } } - else if(sensor2 == 0 && sensor4 == 0 && sensor5 == 1){ + else if((sensor2 == 0 && sensor4 == 0 && sensor5 == 1)||(sensor2 == 0 && sensor4 == 0 && sensor7 == 1)||(sensor2 == 0 && sensor6 == 0 && sensor5 == 1)||(sensor2 == 0 && sensor6 == 0 && sensor7 == 1)){ if(check2 == 0){ check2 = 1; //enter the center course