Start of project 2
Dependencies: Motor Servo mbed mbed-rtos
Diff: main.cpp
- Revision:
- 7:adcdd7556997
- Parent:
- 6:3dc339508843
--- a/main.cpp Tue Oct 16 13:38:55 2018 +0000 +++ b/main.cpp Mon Oct 22 00:18:49 2018 +0000 @@ -11,9 +11,9 @@ float x; float y; AnalogIn turn(p15); //turn dial to adjust servo for horizontal angle of arm SWITCH 2 -DigitalIn swtch1(p19); //moves herndon monument on turn table continuously while switch is on -DigitalIn swtch3(p20); //releases the cover when switch 3 is turned on -DigitalIn swtch4(p21); //retracts arm back to starting position to try again +DigitalIn swtch1(p25); //moves herndon monument on turn table continuously while switch is on +DigitalIn swtch3(p18); //releases the cover when switch 3 is turned on +DigitalIn swtch4(p19); //retracts arm back to starting position to try again Motor m(p26, p30, p29); //launches the cover //DigitalIn sw1 (p16) ; not sure why this is here - maybe broken pin @@ -21,6 +21,7 @@ Servo angle(p22); //servo to adjust horizontal angle of arm int main() { + /* s1 = swtch1.read(); //read state of switch 1 angle.calibrate(0.0009, 90.0); back.calibrate(0.0009, 90.0); //calculate's servos timing by setting pulse width and range @@ -58,10 +59,11 @@ } //end of while loop - +*/ +while(1) { - sw3.read(); //read state of switch 3 (launch the cover) - if (sw3==1) { + swtch3.read(); //read state of switch 3 (launch the cover) + if (swtch3==1) { while(1) { printf("motor on"); m.speed(1.0); @@ -76,7 +78,7 @@ - sw4.read(); //read state of switch 4 (retract arm to try again) + s4 = swtch4.read(); //read state of switch 4 (retract arm to try again) if (s4 == 1){ while(1) { printf("reversed"); @@ -88,4 +90,5 @@ break; } //end of while } //end of if - + }//end of int main +} \ No newline at end of file