initial commit
This commit is contained in:
commit
dbfb1f5a0f
11 changed files with 466 additions and 0 deletions
31
src/main.cpp
Normal file
31
src/main.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <main.h>
|
||||
#include <cud_display.hpp>
|
||||
|
||||
ESPMegaPRO espmega = ESPMegaPRO();
|
||||
CUDDisplay external_display = CUDDisplay();
|
||||
|
||||
void setup() {
|
||||
espmega.begin();
|
||||
espmega.enableIotModule();
|
||||
ETH.begin();
|
||||
espmega.iot->bindEthernetInterface(Ð);
|
||||
espmega.iot->loadNetworkConfig();
|
||||
espmega.iot->connectNetwork();
|
||||
espmega.iot->loadMqttConfig();
|
||||
espmega.iot->connectToMqtt();
|
||||
espmega.enableInternalDisplay(&Serial);
|
||||
espmega.enableWebServer(80);
|
||||
espmega.inputs.registerCallback(on_pin_change);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
espmega.loop();
|
||||
}
|
||||
|
||||
void on_pin_change(uint8_t pin, uint8_t value) {
|
||||
// For pin 0-6, when the pin value changes, toggle the corresponding PWM pin
|
||||
if (pin < 7) {
|
||||
bool new_value = !espmega.outputs.getState(pin);
|
||||
espmega.outputs.digitalWrite(pin, new_value);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue