64 lines
1.1 KiB
Arduino
64 lines
1.1 KiB
Arduino
|
#include <Homie.h>
|
||
|
|
||
|
// homie lib from: https://github.com/marvinroger/homie-esp8266/
|
||
|
|
||
|
|
||
|
HomieNode effectNode("effect", "commands");
|
||
|
HomieNode pixelsNode("pixels", "commands");
|
||
|
|
||
|
|
||
|
bool effectHandler(const HomieRange& range, const String& value) {
|
||
|
int sep = value.indexOf("|");
|
||
|
|
||
|
|
||
|
if(sep > 0) {
|
||
|
|
||
|
//Homie.getLogger() << "scroll " << value << " wait " << wait << endl;
|
||
|
|
||
|
} else {
|
||
|
|
||
|
//Homie.getLogger() << "scroll " << value << endl;
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool pixelsHandler(const HomieRange& range, const String& value) {
|
||
|
int sep = value.indexOf("|");
|
||
|
|
||
|
|
||
|
if(sep > 0) {
|
||
|
|
||
|
//Homie.getLogger() << "scroll " << value << " wait " << wait << endl;
|
||
|
|
||
|
} else {
|
||
|
|
||
|
//Homie.getLogger() << "scroll " << value << endl;
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(115200);
|
||
|
Serial << endl << endl;
|
||
|
|
||
|
|
||
|
Homie_setFirmware("pixelprojektor", "1.0.0");
|
||
|
|
||
|
effectNode.advertise("on").settable(effectHandler);
|
||
|
pixelsNode.advertise("on").settable(pixelsHandler);
|
||
|
|
||
|
|
||
|
Homie.setup();
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
Homie.loop();
|
||
|
long currentMillis = millis();
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|