Versuch 2

Dependencies:   mbed

Revision:
1:5bcd7fd92f60
Parent:
0:363abd3fc535
Child:
2:0e1b409ff333
diff -r 363abd3fc535 -r 5bcd7fd92f60 main.cpp
--- a/main.cpp	Thu Apr 16 11:54:02 2015 +0000
+++ b/main.cpp	Thu Apr 23 12:12:01 2015 +0000
@@ -3,22 +3,54 @@
 #include "const.h"
 #include "Alle_Befehle.h"
 
+
+
+
+
+/*
+int main()
+{
+    ur_Bertl karel;
+    while( !karel.NextToABeeper() )
+    {
+        karel.Move();
+    }
+    karel.PickBeeper();
+    
+}
+
+*/
+
+
+
+
 int main()
 {
-    Alle_Befehle_bertl  karel;
+    ur_Bertl karel;
+    int z = 0;
     
-    for (int x = 0; x < 10; x++) 
+    while(1) 
     {
-       
-       
-        if( karel.IsButtonPressed(BTN_FLL || BTN_FL || BTN_FM || BTN_FR || BTN_FRR || BTN_BL || BTN_BM || BTN_BR))
-            karel.TurnLeft();
-
-        
+        if(karel.NextToABeeper()) 
+        {
+            z = z++;
+            if(z == 1) 
+            {
+                karel.RGBLed(1,0,0);
+            }
+            
+            else if(z == 2) 
+            {
+                karel.RGBLed(0,1,0);
+            }
+            
+            else if(z > 2) 
+            {
+                karel.RGBLed(0,0,1);
+            }
+            
+        }
         karel.Move();
 
     }
-    
-    karel.ShutOff();
-
-}
+}
\ No newline at end of file