Homie
This commit is contained in:
parent
796d3db498
commit
71dfc33a9c
|
@ -1,22 +1,38 @@
|
|||
/**
|
||||
* Print each digit over Serial as it is dialed.
|
||||
* See the README for detailed documentation.
|
||||
*/
|
||||
#include <Homie.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
#include "RotaryDialer.h"
|
||||
|
||||
#define PIN_READY D6
|
||||
#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);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
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() {
|
||||
Homie.loop();
|
||||
ArduinoOTA.handle();
|
||||
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