Disabled button

This commit is contained in:
Ard Kuijpers
2020-06-26 17:14:48 +02:00
parent ea7246e7c3
commit ff5a062ecd

View File

@@ -10,7 +10,7 @@
//const int echoPin = D2;
const int relayPin = D1;
const int contactPin = D2;
const int buttonPin = D6;
// const int buttonPin = D6;
const int dhtPin = D7; ;
const int ledPin = LED_BUILTIN;
const int heartbeatPin = LED_BUILTIN;
@@ -22,7 +22,7 @@ bool relayInverse = true;
//PingNode obstacleNode("obstacle",trigPin,echoPin);
DHT22Node airNode("air",dhtPin,TEMPERATURE_INTERVAL);
RelayNode relayNode("relay",relayPin,ledPin,relayInverse);
ButtonNode buttonNode("button",buttonPin);
// ButtonNode buttonNode("button",buttonPin);
ContactNode contactNode("contact",contactPin);
Heartbeater heartbeater(heartbeatPin, heartbeatPin == LED_BUILTIN ? LOW : HIGH);
@@ -32,10 +32,10 @@ void changeHandler() {
signal_led();
}
void buttonChangeHandler(bool down) {
Homie.getLogger() << "Button changing relay to " << (down ? "on" : "off") << endl;
relayNode.setRelay(down);
}
// void buttonChangeHandler(bool down) {
// Homie.getLogger() << "Button changing relay to " << (down ? "on" : "off") << endl;
// relayNode.setRelay(down);
// }
void loopHandler() {
heartbeater.loop();
@@ -52,10 +52,10 @@ void setup() {
pinMode(ledPin, OUTPUT);
Homie_setBrand("EtxeanIoT");
Homie_setFirmware("etxean-garagesensor", "1.2.4");
Homie_setFirmware("etxean-garagesensor", "1.3.0");
Homie.setLoopFunction(loopHandler);
// obstacleNode.setChangeHandler(changeHandler);
buttonNode.onChange(buttonChangeHandler);
// buttonNode.onChange(buttonChangeHandler);
Homie.setup();
}