working

Dependencies:   Motor mbed

Files at this revision

API Documentation at this revision

Comitter:
m175694
Date:
Thu Oct 16 14:21:46 2014 +0000
Parent:
0:833afd26d33b
Commit message:
final motor code

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 833afd26d33b -r 214c872ef845 main.cpp
--- a/main.cpp	Thu Oct 09 14:56:57 2014 +0000
+++ b/main.cpp	Thu Oct 16 14:21:46 2014 +0000
@@ -1,27 +1,47 @@
 #include "mbed.h"
 #include "Motor.h"
-
-
-DigitalIn sw2(p16);
+float motspeed=.3;
+int count = 0;
+int notdone=1;
+int i;
+int count2 = 0;
+DigitalIn sw1(p16);
 int main()
 {
     Motor m(p26,p29,p30);
 
+
     while(1) {
-        if (sw2) {
-
-            m.speed(0.3);
-            wait(.15);
-
+        while (count < 10 && sw1 !=0) {
+            m.speed(motspeed);
+            wait(.08);
             m.speed(0.0);
-            wait(1.5);
+            wait(.3);
+            count ++;
+        }
+        while (count2 < 10 && sw1 !=0) {
+            m.speed(-motspeed);
+            wait(.08);
+            m.speed(0.0);
+            wait(.3);
+            count2 ++;
 
-            m.speed(-0.3);
-            wait(.15);
+        }
+        count=0;
+        count2=0;
+        if(sw1==0) {
 
-            m.speed(0.0);
-            wait(1.5);
         }
 
     }
+
 }
+
+
+
+
+
+
+
+
+