Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
98:3ea8058f4c54
Parent:
92:330746c526b7
Child:
99:0fa83e641f75
--- a/Light.cpp	Fri Mar 14 21:25:46 2014 +0000
+++ b/Light.cpp	Fri Mar 14 21:36:08 2014 +0000
@@ -148,14 +148,16 @@
  
  // Blink 
  void Light::blinkLight() { 
+    boolean forward = true;
+    if (this->m_current_state == 0) forward = false;
     this->m_is_blinking = true;
-    this->on();
-    if (PL_ENABLE && this->pl() != NULL) this->pl()->on();
-    wait_ms(500);
+    if (forward) this->on(); else this->off();
+    if (PL_ENABLE && this->pl() != NULL) { if (forward) this->pl()->on(); else this->pl()->off(); }
+    wait_ms(LIGHT_BLINK_WAIT_MS);
     this->m_is_blinking = true;
-    this->off();
-    if (PL_ENABLE && this->pl() != NULL) this->pl()->off();
-    wait_ms(500);
+    if (forward) this->off(); else this->on();
+    if (PL_ENABLE && this->pl() != NULL) { if (forward) this->pl()->off(); else this->pl()->on(); }
+    wait_ms(LIGHT_BLINK_WAIT_MS);
   }
   
  // dim