Margreeth de Breij / Mbed 2 deprecated frdm_Motortryout2

Dependencies:   Encoder MODSERIAL mbed HIDScope

Fork of frdm_Motortryout2 by Robert Schulte

Files at this revision

API Documentation at this revision

Comitter:
Margreeth95
Date:
Mon Sep 21 11:27:52 2015 +0000
Parent:
3:051c91b04acd
Child:
5:672798238952
Commit message:
Switch;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Sep 21 11:16:34 2015 +0000
+++ b/main.cpp	Mon Sep 21 11:27:52 2015 +0000
@@ -16,16 +16,34 @@
     pc.baud(9600);
     while(true)
     {
-            if(button1 == 0)
+           char c = pc.getc();
+           switch(c)
+           {
+                case 'f':
                 {
                     motor2direction = 1;
                     motor2speed = 0.5f;
-                    pc.printf("het werkt");
+                    pc.printf("het werkt\n");
                     wait(1);
                     led = 0;
                     wait(0.2f);
                     motor2speed = 0;
                     led = 1;
+                    break;
                 }
+                
+                case 'r':
+                 {
+                    motor2direction = -1;
+                    motor2speed = 0.5f;
+                    pc.printf("dit werkt ook\n");
+                    wait(1);
+                    led = 0;
+                    wait(0.2f);
+                    motor2speed = 0;
+                    led = 1;
+                    break;
+                }
+            }
     }   
 }
\ No newline at end of file