ESP + Reorganizacja
This commit is contained in:
19
ESP32/ESP32-HomeSpan/DEV_RELAY.h
Normal file
19
ESP32/ESP32-HomeSpan/DEV_RELAY.h
Normal file
@@ -0,0 +1,19 @@
|
||||
struct DEV_RELAY : Service::Switch { // deriving from the HomeSpan Switch service
|
||||
|
||||
int relayPin;
|
||||
SpanCharacteristic *power;
|
||||
|
||||
DEV_RELAY(int relayPin) : Service::Switch() {
|
||||
|
||||
power = new Characteristic::On();
|
||||
this->relayPin = relayPin;
|
||||
pinMode(relayPin, OUTPUT);
|
||||
}
|
||||
|
||||
boolean update() {
|
||||
|
||||
digitalWrite(relayPin, power->getNewVal());
|
||||
|
||||
return(true);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user