Farbod Jam / Mbed 2 deprecated GOLOOMOTOR

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
farbodjam
Date:
Thu Aug 11 15:38:13 2011 +0000
Parent:
0:cc4cc8826661
Commit message:
press u to fast , press d to slow , press h to stop

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Aug 11 15:31:32 2011 +0000
+++ b/main.cpp	Thu Aug 11 15:38:13 2011 +0000
@@ -7,7 +7,7 @@
  float s = 0.00;
  int main() {
 
- pc.printf("Press 'u' to turn motor1 speed up, 'd' to turn it down\n");
+ pc.printf("Press 'u' to turn motors speed up, 'd' to turn it down and 'h' to stop\n");
     while(1) {
         char c = pc.getc();
         if((c == 'u') && (s < 2.5)) {
@@ -18,8 +18,14 @@
     }
             if((c == 'd') && (s > 0.0)) {
             s -= 0.01;
-    A.stop(1);
-    B.stop(1);
+        A.speed(s); 
+        B.speed(s);
+    wait(0.02);
+     }
+                 if((c == 'h') && (s > 0.0)) {
+            s -= 0.01;
+        A.stop(1); 
+        B.stop(1);
     wait(0.02);
      }
      }