#include #include #include #include "MCP42010.h" ESP8266WebServer http_service(80); MCP42010 msp42010(D8); void setup() { Serial.begin(115200); msp42010.setup(); WiFiManager wifiManager; wifiManager.setConfigPortalTimeout(600); Serial.printf_P(PSTR("Setting up WiFi\n")); WiFi.hostname("oekofen"); if (!wifiManager.autoConnect("oekofen-thermo")) { Serial.printf_P(PSTR("Failed to connect and hit timeout\n")); delay(5000); ESP.restart(); } http_service.on("/", HTTP_GET, []() { uint8_t val = random(0, 255); //msp42010.setPot(MCP42010::P0, val); msp42010.setPot(MCP42010::P1, val); http_service.send(200, PSTR("text/plain"), String(val)); }); http_service.begin(); Serial.println("Setup done"); } void loop() { //http_service.handleClient(); if (Serial.available() > 0) { while (Serial.read() >= 0) {} uint8_t val = random(0, 255); //msp42010.setPot(MCP42010::P0, val); msp42010.setPot(MCP42010::P1, val); Serial.println(val, DEC); } }