Start of project 2

Dependencies:   Motor Servo mbed mbed-rtos

Revision:
4:a3e95c9d56d5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp.orig	Wed Oct 10 12:33:06 2018 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "stdio.h"
+#include "Motor.h"
+#include "math.h"
+#include "Servo.h"
+
+int s1, s3, s4, i;
+float x;
+DigitalIn swtch1(p19);
+DigitalIn swtch3(p20);
+DigitalIn swtch4(p21);
+AnalogIn turn(p22);
+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
+      
+      
+      while (1)
+      {
+        x = turn.read();
+        angle = x;
+        wait (.05);
+          
+          } //end of while loop
+      
+    } //end of int main