Gruppe 3 / Mbed 2 deprecated PES1

Dependencies:   Servo mbed pixy

Fork of PES by Gruppe 3

Files at this revision

API Documentation at this revision

Comitter:
schneju2
Date:
Tue Apr 18 12:09:46 2017 +0000
Parent:
7:edb4e0cfc0d1
Child:
9:d9e46f9c9e40
Commit message:
neu

Changed in this revision

Roboter.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
--- a/Roboter.cpp	Tue Apr 11 15:42:22 2017 +0000
+++ b/Roboter.cpp	Tue Apr 18 12:09:46 2017 +0000
@@ -41,21 +41,25 @@
 
     if(sensors[0] < x && sensors[1] < x && sensors[5] < x) {  // alle sensoren aktiv, roboter fährt nach hinten
         offsetLin = -0.1f;
+        printf("Alle sensoren aktiv"); 
     }
 
     if(sensors[0].read() < x && sensors[5] > x) { // sensor vorne, roboter dreht nach links
         offsetDir = -0.05;
         offsetLin = 0;
+        printf(" sensoren vorne"); 
     }
     
     if(sensors[1] < x) {     // sensor rechts, roboter dreht nach links
         offsetDir = -0.05;
         offsetLin = 0;
+        printf("sensor rechts"); 
     }
     
     if(sensors[5] < x && sensors[1]>(x+0.02f)) {     // sensor links, roboter dreht nach rechts
         offsetDir = 0.05;
         offsetLin = 0;
+        printf("sensor links"); 
     }
 
     *pwmL = 0.5f+offsetDir+offsetLin; // Setzt die Duty-Cycle auf 50%
--- a/main.cpp	Tue Apr 11 15:42:22 2017 +0000
+++ b/main.cpp	Tue Apr 18 12:09:46 2017 +0000
@@ -39,6 +39,9 @@
     enableMotorDriver = 1; // Schaltet die Motoren ein
     pwmL.period(0.00005f); // Setzt die Periode auf 50 μs
     pwmR.period(0.00005f);
+    pwmL = 0.5f;
+    pwmR = 0.5f; 
+   
 
     int state = 1; // Diese Variable gibt an in welchem State man sich befindet
 
@@ -51,8 +54,8 @@
 
                 case 1: // Roboter Anschalten mit Knopf
 
-                    if (switchOnOff == 1) {
-                        state = 2;
+                    if (switchOnOff== 0){
+                        state = 5;
                     }
 
                     break;
@@ -96,9 +99,12 @@
 
                 case 5: // Aufnehmen des Klotzes
 
-
+ roboter1.bandeAusweichen();
                     
                     break;
+                    
+                    
+                default: break;  
 
                     
             }