Update src.ino
This commit is contained in:
parent
0997c2561b
commit
62b1e9bd35
19
src/src.ino
19
src/src.ino
|
|
@ -47,16 +47,21 @@ struct LED_Service : Service::LightBulb {
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
struct reverseLED : Blinkable {
|
struct invertedLED : Blinkable { // create a child class derived from Blinkable
|
||||||
|
|
||||||
int pin;
|
int pin; // variable to store the pin number
|
||||||
|
|
||||||
reverseLED(int pin) : pin{pin} {pinMode(pin,OUTPUT);digitalWrite(pin,1);}
|
invertedLED(int pin) : pin{pin} { // constructor that initializes the pin parameter
|
||||||
void on() override {digitalWrite(pin,LOW);}
|
pinMode(pin,OUTPUT); // set the pin to OUTPUT
|
||||||
void off() override {digitalWrite(pin,HIGH);}
|
digitalWrite(pin,HIGH); // set pin HIGH (which is off for an inverted LED)
|
||||||
int getPin() override {return(pin);}
|
}
|
||||||
|
|
||||||
|
void on() override { digitalWrite(pin,LOW); } // required function on() - sets pin LOW
|
||||||
|
void off() override { digitalWrite(pin,HIGH); } // required function off() - sets pin HIGH
|
||||||
|
int getPin() override { return(pin); } // required function getPin() - returns pin number
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
@ -67,7 +72,7 @@ void setup() {
|
||||||
// homeSpan.setSerialInputDisable(true);
|
// homeSpan.setSerialInputDisable(true);
|
||||||
homeSpan.enableOTA();
|
homeSpan.enableOTA();
|
||||||
|
|
||||||
homeSpan.setStatusDevice(new reverseLED(13));
|
homeSpan.setStatusDevice(new invertedLED(13)); // set Status LED to be a new Blinkable device attached to pin 13
|
||||||
homeSpan.setStatusAutoOff(30);
|
homeSpan.setStatusAutoOff(30);
|
||||||
|
|
||||||
homeSpan.begin(Category::Lighting,"HomeSpan LED");
|
homeSpan.begin(Category::Lighting,"HomeSpan LED");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue