Matthias Praja / Mbed 2 deprecated All-15Final

Dependencies:   mbed

Fork of All-15 by Ladner-Praja

Revision:
11:4084ae1f1be8
Parent:
10:389c1c4c1f2b
Child:
12:070fc8ec44b6
--- a/main.cpp	Tue Jul 07 21:51:30 2015 +0000
+++ b/main.cpp	Tue Jul 07 22:08:39 2015 +0000
@@ -58,6 +58,7 @@
     i2c.stop();
     
     int waiting = 0;
+    int output = 0xff;
     bool active = false;
     
     while(1){
@@ -83,16 +84,21 @@
             }
             else
             {
+                output = 0xff;
                 if((myline&0x01)>0)
                 {
                     MotorR_FORWARD = 0;  
                     MotorR_EN=0;
+                    output=output&(~0x80);
                 }
                 else
                 {
                     MotorR_FORWARD = 1;  
                     if((myline&0x02)>0)
+                    {
                         MotorR_EN=0.25;
+                        output=output&(~0x40);
+                    }
                     else
                         MotorR_EN=0.5;
                 }
@@ -101,15 +107,25 @@
                 {
                     MotorL_EN=0;
                     MotorL_FORWARD = 0;  
+                    output=output&(~0x10);
                 }
                 else
                 {
                     MotorL_FORWARD = 0;  
                     if((myline&0x04)>0)
+                    {
                         MotorL_EN=0.25;
+                        output=output&(~0x20);
+                    }
                     else
                         MotorL_EN=0.5;
                 }
+                myled=myline;
+                i2c.start();
+                  i2c.write(0x40);
+                  i2c.write(0x02); 
+                  i2c.write(output);
+                i2c.stop();
             }
             myrgb=3;
         }
@@ -156,5 +172,13 @@
         //40->Rechts
         //80->Links
         
+        //01->LinksWeis
+        //02->VorneGelbLinks
+        //04->RechtsWeis
+        //08->VorneGelbRechts
+        //10->LinksRot
+        //20->HintenGelbLinks
+        //40->HintenGelbRechts
+        //80->RechtsRot
         }
 }
\ No newline at end of file