#include #include //#include // I replaced this with the following line: #include const char* ssid = ""; // I put my network's SSID here const char* password = ""; // and the password here WebServer server(80); Servo myservo; static const int servoPin = D3; // I put the pin of my servo here String html = R"rawliteral(

Servo Control

// I made the minimum angle 40 degrees and the maximum 180 degrees. These seemed to work well with the servo.

Angle: 90

)rawliteral"; void setup() { Serial.begin(115200); myservo.attach(servoPin); myservo.write(90); WiFi.begin(ssid, password); Serial.print("Connected: "); Serial.println(WiFi.localIP()); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi.."); } Serial.println("Connected: " + WiFi.localIP().toString()); server.on("/", HTTP_GET, []() { server.send(200, "text/html", html); }); server.on("/set", HTTP_GET, []() { if (server.hasArg("angle")) { int angle = server.arg("angle").toInt(); angle = constrain(angle, 40, 180); myservo.write(angle); server.send(200, "text/plain", "OK"); } }); server.begin(); } void loop() { server.handleClient(); }