hej

Dependencies:   mbed

Revision:
0:36611331980a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 05 09:30:52 2014 +0000
@@ -0,0 +1,80 @@
+#include "mbed.h" 
+#include "hack_motor.h" 
+  
+Serial pc(USBTX, USBRX); 
+  
+Wheel robot; 
+  
+main() 
+    { 
+        robot.init(); 
+        char c; 
+        pc.printf(" speed 1, 2 & 3, frem w, bagud s, venstre a & hoejre d"); 
+          
+        while (1) 
+            { 
+            c = pc.getc(); 
+              
+            switch (c) 
+                {  
+                    case 0x31: 
+                        robot.speed = 1.0; 
+                        pc.printf("1"); 
+                        break; 
+                          
+                    case 0x32: 
+                        robot.speed = 0.5; 
+                        pc.printf("2"); 
+                        break; 
+                          
+                    case 0x33:  
+                        robot.speed = 0.25; 
+                        pc.printf("3"); 
+                        break; 
+                          
+                    case 0x77: 
+                        robot.FW(); 
+                        pc.printf("w"); 
+                        break; 
+                      
+                    case 0x73: 
+                        robot.BW(); 
+                        pc.printf("s"); 
+                        break; 
+                          
+                    case 0x61: 
+                        robot.left();  
+                        pc.printf("a"); 
+                        break; 
+                          
+                    case 0x64: 
+                        robot.right(); 
+                        pc.printf("d"); 
+                        break; 
+                        
+                    case 'n':
+                        robot.open();
+                        pc.printf("n");
+                        break;
+                        
+                        case 'm':
+                        robot.close();
+                        pc.printf("m");
+                        break;
+                        
+                        case 'h':
+                        robot.hejs();
+                        pc.printf("h");
+                        break;
+                        
+                        case 'b':
+                        robot.saenk();
+                        pc.printf("b");
+                        break;
+                      
+                    default : 
+                        robot.stop(); 
+                        break; 
+                    } 
+                } 
+    }