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:
87:e9d77e9f9eae
Parent:
33:339eb862a4c4
Child:
91:8732d54328ae
--- a/PhilipsLight.cpp	Wed Mar 12 20:07:50 2014 +0000
+++ b/PhilipsLight.cpp	Wed Mar 12 23:47:30 2014 +0000
@@ -41,9 +41,21 @@
  // turn the light off
  void PhilipsLight::off() { this->m_state = 0; this->update(); }
  
+ // blink the light
+ void PhilipsLight::blink() { this->m_state = 2; this->doblink(); }
+ 
  // dim the light
  void PhilipsLight::dim(int dim) { this->m_dim = dim; this->update(); }
  
+ // blinking loop
+ void PhilipsLight::doblink() {
+     for(int i=0;i<5;++i) {
+         this->on();
+         wait_ms(1000);
+         this->off();
+     }
+ }
+ 
  // set the light state
  void PhilipsLight::update() {
      // create the state string