![](/media/cache/group/220px-Herndon_Monument_Climb.jpg.50x50_q85.jpg)
Start of project 2
Dependencies: Motor Servo mbed mbed-rtos
main.cpp
- Committer:
- m215676
- Date:
- 2018-10-09
- Revision:
- 1:7133819e4265
- Parent:
- 0:9347308e8e1a
- Child:
- 2:60a8105d0d20
File content as of revision 1:7133819e4265:
#include "mbed.h" #include "stdio.h" #include "Motor.h" #include "math.h" int s1, s3, s4, i; DigitalIn swtch1(p19); DigitalIn swtch3(p20); DigitalIn swtch4(p21); Motor m(p26, p30, p29); Servo back(p21); Servo angle(p22); int main() { s1 = swtch1.read(); //read state of switch 1 back.calibrate(0.0009, 90.0); //calculate's servos timing by setting pulse width and range while (s1 == 1) { for (i = 0; i < 18; i++) //moves monument forward { back = 0; back = (0.0 + (i/18.0)); s1 = swtch1.read(); //read state of switch 1 }//end of for loop for (i = 0; i < 35; i++) //moves monument backwards { back = 1; back = (1.0 - (i/18.0)); s1 = swtch1.read(); //read state of switch 1 }//end of for loop }//end of while loop } //end of int main