xx

Dependencies:   Servo mbed pixy

Fork of PES1 by Gruppe 3

Revision:
14:7e330f65f26e
Parent:
13:7eba9911e196
Child:
16:0a1703438e8b
--- a/main.cpp	Wed Apr 19 15:57:28 2017 +0000
+++ b/main.cpp	Wed Apr 19 16:27:30 2017 +0000
@@ -48,7 +48,7 @@
 
     while(1) {
 
-
+        int camValue = readCamera();
 
         switch(state) {
 
@@ -61,13 +61,13 @@
                 break;
 
             case 1:
-                if(readCamera() == 1 || readCamera() == 2 || readCamera() == 3) {           // Die Kamera erkennt ein grünen Klotz
+                if(camValue == 1 || camValue == 2 || camValue == 3) {           // Die Kamera erkennt ein grünen Klotz
                     state = 4;
                 }
-                if(readCamera() == 4) {     // Roboter in Position
+                if(camValue == 4) {     // Roboter in Position
                     state = 5;
                 }
-                if(readCamera() == 0){
+                if(camValue == 0){
                     state = tempState;
                     }
 
@@ -109,15 +109,15 @@
 
             case 4: // Roboter erkennt gründer Klotz, Klotz wird angefahren
                 roboter1.bandeAusweichen();
-                if(readCamera() == 1) {     // links fahren
+                if(camValue == 1) {     // links fahren
                     pwmL = 0.45f;
                     pwmR = 0.45f;
                 }
-                if(readCamera() == 2) {     // rechts fahren
+                if(camValue == 2) {     // rechts fahren
                     pwmL = 0.55f;
                     pwmR = 0.55f;
                 }
-                if(readCamera() == 3) {     // gerade fahren
+                if(camValue == 3) {     // gerade fahren
                     pwmL = 0.55f;
                     pwmR = 0.45f;
                 }