Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

  1. #include <ESP8266React.h>
  2. #include <LightMqttSettingsService.h>
  3. #include <LightStateService.h>
  4. #define SERIAL_BAUD_RATE 115200
  5. AsyncWebServer server(80);
  6. ESP8266React esp8266React(&server);
  7. LightMqttSettingsService lightMqttSettingsService =
  8. LightMqttSettingsService(&server, esp8266React.getFS(), esp8266React.getSecurityManager());
  9. LightStateService lightStateService = LightStateService(&server,
  10. esp8266React.getSecurityManager(),
  11. esp8266React.getMqttClient(),
  12. &lightMqttSettingsService);
  13. void setup() {
  14. // start serial and filesystem
  15. Serial.begin(SERIAL_BAUD_RATE);
  16. // start the framework and demo project
  17. esp8266React.begin();
  18. // load the initial light settings
  19. lightStateService.begin();
  20. // start the light service
  21. lightMqttSettingsService.begin();
  22. // start the server
  23. server.begin();
  24. }
  25. void loop() {
  26. // run the framework's loop function
  27. esp8266React.loop();
  28. }