Mathias Lyngklip / Mbed 2 deprecated RoboticHackathonFINAL

Dependencies:   Autopilot dillerdasker Rfid mbed

Fork of RoboticHackathon2 by Mathias Lyngklip

Files at this revision

API Documentation at this revision

Comitter:
iLyngklip
Date:
Tue Apr 08 14:56:42 2014 +0000
Parent:
2:b996c95912b5
Child:
4:6a4a59e4e3dd
Commit message:
Auto-Piloten Jepediah Kerman 2;

Changed in this revision

Autopilot.lib Show annotated file Show diff for this revision Revisions of this file
hack_motor.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Autopilot.lib	Tue Apr 08 14:56:42 2014 +0000
@@ -0,0 +1,1 @@
+Autopilot#a95df5566911
--- a/hack_motor.cpp	Mon Apr 07 06:24:19 2014 +0000
+++ b/hack_motor.cpp	Tue Apr 08 14:56:42 2014 +0000
@@ -38,16 +38,16 @@
     
 void Wheel::right()
     {
-        M1A.write(0.75); //Left side forward 50%
-        M2A.write(0.25); //Right side backwards 50%
+        M1A.write(0.75); //Left side forward 75%
+        M2A.write(0.25); //Right side backwards 75%
         M1B = 0;
         M2B = 1;
     }
     
 void Wheel::left()
     {
-        M1A.write(0.25); //Right side forward 50%
-        M2A.write(0.75); //Left side backwards 50%
+        M1A.write(0.25); //Right side forward 75%
+        M2A.write(0.75); //Left side backwards 75%
         M1B = 1;
         M2B = 0;
     }
--- a/main.cpp	Mon Apr 07 06:24:19 2014 +0000
+++ b/main.cpp	Tue Apr 08 14:56:42 2014 +0000
@@ -1,25 +1,27 @@
+#include "hack_motor.h" 
+#include "auto_pilot.h"
 #include "mbed.h"
 #include "HCSR04.h"
 #include "PwmOut.h"
-#include "hack_motor.h" 
 
 
 Serial pc(USBTX, USBRX);
- HCSR04 sensor(PTA13, PTD5, PTD0, PTD2);
+HCSR04 sensor(PTA13, PTD5, PTD0, PTD2);
     
-Wheel robot; 
+Wheel robot;
 int control = 0;
-int L1 = 0;
-int L2 = 0;
+extern double L1 = 0;
+extern double L2 = 0;
 int main(){
     
 
     pc.baud(9600);
+    pc.printf(" speed 1, 2 & 3, frem w, bagud s, venstre a & hoejre d"); 
    
     while(control == 0){                
         robot.init(); 
         char c; 
-        pc.printf(" speed 1, 2 & 3, frem w, bagud s, venstre a & hoejre d"); 
+        
           
             { 
             c = pc.getc();  
@@ -50,16 +52,16 @@
                         pc.printf("w"); 
                         break; 
                           
-                    case 0x61: 
-                        robot.left();  
+                    case 'a': 
+                        robot.right();  
                         pc.printf("a"); 
                         wait(0.1);
                         robot.stop();
                         
                         break; 
                           
-                    case 0x64: 
-                        robot.right(); 
+                    case 'd': 
+                        robot.left(); 
                         pc.printf("d");
                         wait(0.1);
                         robot.stop();