Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: MBEDLight.cpp
- Revision:
- 91:8732d54328ae
- Parent:
- 90:0fed8d3e0b81
- Child:
- 92:330746c526b7
--- a/MBEDLight.cpp Thu Mar 13 00:07:59 2014 +0000
+++ b/MBEDLight.cpp Thu Mar 13 17:25:18 2014 +0000
@@ -20,13 +20,10 @@
#include "LightDimmerAction.h"
#include "LightSwitchAction.h"
+
// default constructor
MBEDLight::MBEDLight(ErrorHandler *error_handler,Transport *transports[NUM_TRANSPORTS],int instance,void *endpoint) : Light(error_handler,transports,instance,endpoint) {
- this->m_current_state = LIGHT_DEFAULT_STATE;
- if (this->m_current_state == 1) this->on();
- if (this->m_current_state == 0) this->off();
- if (this->m_current_state == 2) this->blink();
}
// destructor
@@ -34,23 +31,10 @@
}
// turn ON
- void MBEDLight::on() { this->logger()->led2On(); this->logger()->led3On(); Light::on(); this->logger()->dimRGB(1.0); this->m_current_state = 1; }
+ void MBEDLight::on() { this->logger()->led2On(); this->logger()->led3On(); Light::on(); this->logger()->dimRGB(1.0); }
// turn OFF
- void MBEDLight::off() { this->logger()->led2Off(); this->logger()->led3Off(); Light::off(); this->logger()->dimRGB(1.0); this->m_current_state = 0;}
-
- // Blink
- void MBEDLight::blink() {
- int current_state = this->m_current_state;
- for(int i=0;i<6;++i) {
- this->on();
- wait_ms(500);
- this->off();
- wait_ms(500);
- }
- if (current_state == 1) this->on();
- if (current_state == 0) this->off();
-}
+ void MBEDLight::off() { this->logger()->led2Off(); this->logger()->led3Off(); Light::off(); this->logger()->dimRGB(1.0); }
// dim
void MBEDLight::dim(int value) {