-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
36 lines (28 loc) · 1.05 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <ESP8266React.h>
#include <LightMqttSettingsService.h>
#include <LightStateService.h>
#define SERIAL_BAUD_RATE 115200
AsyncWebServer server(80);
ESP8266React esp8266React(&server);
LightMqttSettingsService lightMqttSettingsService =
LightMqttSettingsService(&server, esp8266React.getFS(), esp8266React.getSecurityManager());
LightStateService lightStateService = LightStateService(&server,
esp8266React.getSecurityManager(),
esp8266React.getMqttClient(),
&lightMqttSettingsService);
void setup() {
// start serial and filesystem
Serial.begin(SERIAL_BAUD_RATE);
// start the framework and demo project
esp8266React.begin();
// load the initial light settings
lightStateService.begin();
// start the light service
lightMqttSettingsService.begin();
// start the server
server.begin();
}
void loop() {
// run the framework's loop function
esp8266React.loop();
}