Gun Trigger Code

Dependencies:   Servo mbed

Revision:
0:e65fc2ec46d6
Child:
1:45d7c2476250
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 10 14:40:32 2018 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "Servo.h"
+
+Servo myservo(p21);
+float pos;
+char c;
+int main()
+{
+    myservo.calibrate(0.0009,90.0);
+    myservo=0.0;
+    wait(1);
+    while (1) {
+        c = getchar ();
+        for (pos =0.0; pos<=10.0; pos=pos+10.0) {
+            myservo=(pos/10.0);
+            wait (0.07);
+            printf("%f\n",pos);
+        }
+        for (pos =10.0; pos>=0.0; pos=pos-10.0) {
+            myservo=(pos/10.0);
+            wait (0.07);
+            printf("%f\n",pos);
+        }
+    }
+}