motorspeed step

Dependencies:   Encoder MODSERIAL mbed

Fork of frdm_Motortryout2_test by Margreeth de Breij

Files at this revision

API Documentation at this revision

Comitter:
Rvs94
Date:
Thu Oct 22 12:29:39 2015 +0000
Parent:
4:f11dacf12ca7
Commit message:
Motor test vanwege staprespons motor

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f11dacf12ca7 -r 8affd11a5674 main.cpp
--- a/main.cpp	Mon Sep 28 09:21:55 2015 +0000
+++ b/main.cpp	Thu Oct 22 12:29:39 2015 +0000
@@ -6,7 +6,6 @@
 DigitalOut led(LED_RED);
 DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
 PwmOut motor2speed(D5);
-DigitalIn button1(SW3);
 
 int main()
 {
@@ -14,19 +13,13 @@
     motor2direction = 0;
     motor2speed = 0;
     led = 1;
-    pc.baud(9600);
+    pc.baud(115200);
     while(true)
     {
-            if(button1 == 0)
-                {
-                    motor2direction = 1;
-                    motor2speed = 0.5f;
-                    pc.printf("het werkt");
-                    wait(1);
-                    led = 0;
-                    wait(0.2f);
-                    motor2speed = 0;
-                    led = 1;
-                }
+        char c = pc.getc();
+        if( c == 'r')
+        {
+            motor2speed = 1;
+        }
     }   
 }
\ No newline at end of file