Homie
This commit is contained in:
parent
796d3db498
commit
71dfc33a9c
|
@ -1,22 +1,38 @@
|
||||||
/**
|
#include <Homie.h>
|
||||||
* Print each digit over Serial as it is dialed.
|
#include <ArduinoOTA.h>
|
||||||
* See the README for detailed documentation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "RotaryDialer.h"
|
#include "RotaryDialer.h"
|
||||||
|
|
||||||
#define PIN_READY D6
|
#define PIN_READY D6
|
||||||
#define PIN_PULSE D5
|
#define PIN_PULSE D5
|
||||||
|
#define FW_NAME "esp-waehlscheibe"
|
||||||
|
#define FW_VERSION "1.0.0"
|
||||||
|
|
||||||
|
HomieNode dialNode("dial", "number");
|
||||||
RotaryDialer dialer = RotaryDialer(PIN_READY, PIN_PULSE);
|
RotaryDialer dialer = RotaryDialer(PIN_READY, PIN_PULSE);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
dialer.setup();
|
dialer.setup();
|
||||||
|
Homie_setFirmware(FW_NAME, FW_VERSION);
|
||||||
|
Homie_setBrand(FW_NAME);
|
||||||
|
dialNode.advertise("number");
|
||||||
|
Homie.setLoopFunction(loopHandler);
|
||||||
|
Homie.setup();
|
||||||
|
ArduinoOTA.setHostname(Homie.getConfiguration().deviceId);
|
||||||
|
ArduinoOTA.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loopHandler()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
Homie.loop();
|
||||||
|
ArduinoOTA.handle();
|
||||||
if (dialer.update()) {
|
if (dialer.update()) {
|
||||||
Serial.println(dialer.getNextNumber());
|
int ivalue = dialer.getNextNumber();
|
||||||
|
// Serial.println(dialer.getNextNumber());
|
||||||
|
dialNode.setProperty("number").send(String(ivalue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue