motor

Dependencies:   VNH5019 mbed

Revision:
1:6ad72ace0fec
Parent:
0:974de11b1491
Child:
2:b7676b0b020e
--- a/main.cpp	Wed Jun 15 02:09:45 2016 +0000
+++ b/main.cpp	Tue Jul 19 03:51:28 2016 +0000
@@ -7,30 +7,42 @@
 
 int main()
 {
+    xbee.baud(57600);
+    pc.baud(57600);
 
     char c;
 
     while(true) {
         c = xbee.getc();
 
+        // front
         if(c == 'f') {
-            motorShield.changeSpeed(1, 255, 1, 255);
+            xbee.printf("f\n");
+            motorShield.changeSpeed(1, 64, 1, 64);
         }
         
+        // back
         if(c == 'b'){
-            motorShield.changeSpeed(2, 255, 2, 255);
+            xbee.printf("b\n");
+            motorShield.changeSpeed(2, 64, 2, 64);
         }
         
+        // left
         if(c == 'l'){
-            motorShield.changeSpeed(0, 255, 1, 255);
+            xbee.printf("l\n");
+            motorShield.changeSpeed(0, 64, 1, 64);
         }
         
+        // right
         if(c == 'r') {
-            motorShield.changeSpeed(1, 255, 0, 255);
+            xbee.printf("r\n");
+            motorShield.changeSpeed(1, 64, 0, 64);
         }
 
+        // stop
         if(c == 's') {
-            motorShield.changeSpeed(0, 255, 0, 255);
+            xbee.printf("s\n");
+            motorShield.changeSpeed(0, 64, 0, 64);
         }
     }
     return 0;