Bau

Dependencies:   HCSR

Fork of Bertl by Franz Pucher

Revision:
17:308802267a62
Parent:
15:43d6a7e6e64a
Child:
18:1598fdb97db1
--- a/ur_Bertl.cpp	Thu Nov 12 09:05:05 2015 +0000
+++ b/ur_Bertl.cpp	Thu Nov 12 19:05:56 2015 +0000
@@ -29,6 +29,7 @@
     _interrupt.rise(this, &ur_Bertl::increment);    // attach increment function of this counter instance ie. motor sensor
     _count = 0;
     beepersInBag = 0;
+    TurnLedOff(0xFF);
 }
 
 ur_Bertl::ur_Bertl(PinName pin) :  _interrupt(pin)  // create the InterruptIn on the pin specified to Counter
@@ -42,6 +43,7 @@
     _interrupt.rise(this, &ur_Bertl::increment);    // attach increment function of this counter instance ie. motor sensor
     _count = 0;
     beepersInBag = 0;
+   TurnLedOff(0xFF);
 }
 
 // Pulblic methodes
@@ -146,6 +148,7 @@
 
 void ur_Bertl::TurnLedOn(int16_t led)
 {
+    leds = leds | led;
     char cmd[3];
 
     if(led == 0xBB) {
@@ -156,13 +159,14 @@
         LED_blue=0;
     }
     cmd[0] = 0x02;
-    cmd[1] = ~led;
+    cmd[1] = ~leds;
     i2c.write(addr, cmd, 2);
     wait(0.5);
 }
 
 void ur_Bertl::TurnLedOff(int16_t led)
 {
+    leds = leds & ~led;
     char cmd[3];
     if(led == 0xBB) {
         LED_blue=1;
@@ -172,7 +176,7 @@
         LED_blue=1;
     }
     cmd[0] = 0x02;
-    cmd[1] = led;
+    cmd[1] = ~leds;
     i2c.write(addr, cmd, 2);
     wait(0.5);
 }