From 4c07244426073948f507b9c84852c63c7e73037e Mon Sep 17 00:00:00 2001 From: starcalc Date: Sat, 28 Apr 2018 17:10:50 +0200 Subject: [PATCH] Sensor entfernt --- esp-wemos-schild/esp-wemos-schild.ino | 30 +++++---------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/esp-wemos-schild/esp-wemos-schild.ino b/esp-wemos-schild/esp-wemos-schild.ino index 19f73bc..07f6ad7 100644 --- a/esp-wemos-schild/esp-wemos-schild.ino +++ b/esp-wemos-schild/esp-wemos-schild.ino @@ -6,12 +6,10 @@ #include "NeoPatterns.h" #define PIN D1 -#define SENSOR D0 #define NUMPIXELS 80 - - -bool lastSensorValue = false; +#define FW_NAME "esp-schild" +#define FW_VERSION "1.0.1" void StripComplete(){ return; @@ -20,9 +18,6 @@ void StripComplete(){ NeoPatterns pixels = NeoPatterns(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800,&StripComplete); HomieNode stripNode("strip", "strip"); -HomieNode sensorNode("sensor", "sensor"); -Bounce debouncer = Bounce(); - bool onSetColor(const HomieRange& range, const String& value){ if (!range.isRange || range.index < 0 || range.index > 1) { @@ -39,9 +34,6 @@ bool onSetColor(const HomieRange& range, const String& value){ stripNode.setProperty("color_" + String(range.index)).send(value); } - - - bool onSetPixel(const HomieRange& range, const String& value){ if(!range.isRange) { pixels.None(); @@ -115,22 +107,13 @@ bool onSetLength(const HomieRange& range, const String& value){ void loopHandler() { pixels.Update(); - - bool sensorValue = debouncer.read(); - if (Homie.isConfigured() && Homie.isConnected() && sensorValue != lastSensorValue) { - sensorNode.setProperty("motion").send(sensorValue ? "true" : "false"); - lastSensorValue = sensorValue; - } - } void setup() { Serial.begin(115200); - debouncer.attach(SENSOR,INPUT); - debouncer.interval(50); - - Homie_setFirmware("schild", "1.0.0"); + Homie_setFirmware(FW_NAME, FW_VERSION); + Homie_setBrand(FW_NAME); Homie.setLoopFunction(loopHandler); stripNode.advertiseRange("pixel", 0, NUMPIXELS-1).settable(onSetPixel); @@ -140,8 +123,6 @@ void setup() { stripNode.advertise("clear").settable(onSetClear); stripNode.advertise("length").settable(onSetLength); - sensorNode.advertise("motion"); - pixels.begin(); pixels.clear(); pixels.setBrightness(64); @@ -150,7 +131,7 @@ void setup() { Homie.setup(); ArduinoOTA.setHostname(Homie.getConfiguration().deviceId); - ArduinoOTA.setPassword((const char *)"ctdo2342"); +// ArduinoOTA.setPassword((const char *)"ctdo2342"); ArduinoOTA.onStart([]() { pixels.clear(); }); @@ -166,6 +147,5 @@ void setup() { void loop() { Homie.loop(); - debouncer.update(); ArduinoOTA.handle(); }