commit 57d0aaa6f437e5a46f09f3899a680ae7bf89d297 Author: Tyrel Souza Date: Fri Oct 28 01:48:02 2022 -0400 frank water tank diff --git a/data/favicon.ico b/data/favicon.ico new file mode 100644 index 0000000..1997085 Binary files /dev/null and b/data/favicon.ico differ diff --git a/data/index.html b/data/index.html new file mode 100644 index 0000000..5d9d711 --- /dev/null +++ b/data/index.html @@ -0,0 +1,102 @@ + + + + + + + ESP8266 Servo Control + + + + +
+

Water Heater Control

+
+ +

Number of Seconds: 5

+ + +
+
+
+ + + +
+
+
+

Current Action: STOPPED

+
+ + + + + diff --git a/frank_tank.ino b/frank_tank.ino new file mode 100644 index 0000000..7883cf2 --- /dev/null +++ b/frank_tank.ino @@ -0,0 +1,90 @@ +/* + Project made and maintained by Kumar Aditya + + ESP8266 Servo Controller + + Create a ESP8266 Webserver for controlling the real-time position of the servo motor attached to ESP8266. + + Change these lines as per yours: + const char *ssid = "REPLACE_WITH_YOUR_SSID"; // replace with your SSID + const char *password = "REPLACE_WITH_YOUR_PASSWORD"; // replace with your Password + const uint8_t servoPin = D4; // replace with servo pin + + Parts list: + + NodeMCU : + https://amzn.to/397GzNe + + Servo Motor : + https://amzn.to/2SmyFtJ + + The source code can be found at: + https://git.io/JfOQv + + Download ESPAsyncWebServer library : + https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip + + Download ESPAsyncTCP library : + https://github.com/me-no-dev/ESPAsyncTCP/archive/master.zip + + Download ESP8266 Filesystem Uploader : + https://github.com/esp8266/arduino-esp8266fs-plugin/releases/download/0.5.0/ESP8266FS-0.5.0.zip + +*/ + +// Import libraries +#include +#include +#include +#include + + +const char *ssid = "TARDIS"; // replace with your SSID +const char *password = "EvangelionUnit-01"; // replace with your Password +const uint8_t servoPin = D1; // replace with servo pin +/* Create Servo Object */ +Servo servo; +// Create Server instance +AsyncWebServer server(80); +void setup() +{ + // Attach Servo, start SPIFFS and Connect to WiFi + Serial.begin(115200); + servo.attach(servoPin); + servo.write(160); + if (!SPIFFS.begin()) + { + Serial.println("An Error has occurred while mounting SPIFFS"); + return; + } + WiFi.begin(ssid, password); + Serial.print("Connecting to WiFi.."); + while (WiFi.status() != WL_CONNECTED) + { + delay(1000); + Serial.print("."); + } + Serial.print("\nConnected to the WiFi network: "); + Serial.print(WiFi.SSID()); + Serial.print("IP address:"); + Serial.print(WiFi.localIP()); + // Send home page from SPIFFS + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + Serial.println("Send index.html."); + request->send(SPIFFS, "/index.html", "text/html"); + }); + // Receive Angle from client and process it + server.on("/angle", HTTP_POST, [](AsyncWebServerRequest *request) { + String angle = request->arg("angle"); + Serial.println("Current Position: " + angle + "°"); + servo.write(angle.toInt()); + request->send(200); + }); + // Send Favicon + server.serveStatic("/favicon.ico", SPIFFS, "/favicon.ico"); + // Begin Server + server.begin(); +} +void loop() +{ +}