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.

38 lines
810 B

  1. #include <DemoProject.h>
  2. #include <ESP8266React.h>
  3. #include <FS.h>
  4. #define SERIAL_BAUD_RATE 115200
  5. AsyncWebServer server(80);
  6. ESP8266React esp8266React(&server, &SPIFFS);
  7. DemoProject demoProject = DemoProject(&server, &SPIFFS, esp8266React.getSecurityManager());
  8. void setup() {
  9. // start serial and filesystem
  10. Serial.begin(SERIAL_BAUD_RATE);
  11. // start the file system (must be done before starting the framework)
  12. #ifdef ESP32
  13. SPIFFS.begin(true);
  14. #elif defined(ESP8266)
  15. SPIFFS.begin();
  16. #endif
  17. // start the framework and demo project
  18. esp8266React.begin();
  19. // start the demo project
  20. demoProject.begin();
  21. // start the server
  22. server.begin();
  23. }
  24. void loop() {
  25. // run the framework's loop function
  26. esp8266React.loop();
  27. // run the demo project's loop function
  28. demoProject.loop();
  29. }