Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: PhilipsLight.cpp
- Revision:
- 87:e9d77e9f9eae
- Parent:
- 33:339eb862a4c4
- Child:
- 91:8732d54328ae
diff -r 8ddeaa7389a6 -r e9d77e9f9eae PhilipsLight.cpp --- 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