From d836dfb82273f07e4172d22521916f56391f8d31 Mon Sep 17 00:00:00 2001
From: PrajwalPrabhuiisc <75930064+PrajwalPrabhuiisc@users.noreply.github.com>
Date: Tue, 5 Jul 2022 14:24:46 +0530
Subject: [PATCH] Add files via upload
Horizontal control of the mechanism with basic control
---
platform/platform.ino | 75 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 platform/platform.ino
diff --git a/platform/platform.ino b/platform/platform.ino
new file mode 100644
index 0000000..8d1cc3e
--- /dev/null
+++ b/platform/platform.ino
@@ -0,0 +1,75 @@
+#include
+#include
+#include
+
+// Replace with your network credentials
+const char* ssid = "Galaxy M211BF1";
+const char* password = "pufy3612";
+
+ESP8266WebServer server(80); //instantiate server at port 80 (http port)
+
+String page = ""; //For the Web Server
+String page2=""; //For updating Status of motor 1
+void setup(void)
+{
+ //the HTML of the web page
+ page = "Motor Control Web Server
";
+
+ pinMode(D2, OUTPUT); // inputs for motor 1
+ pinMode(D1,OUTPUT);
+ Serial.begin(115200);
+ WiFi.begin(ssid, password); //begin WiFi connection
+ Serial.println("");
+
+ // Wait for connection
+ while (WiFi.status() != WL_CONNECTED) {
+ delay(500);
+ Serial.print(".");
+ }
+ digitalWrite(LED_BUILTIN,HIGH); // when connected turns high
+ Serial.println("");
+ Serial.print("Connected to ");
+ Serial.println(ssid);
+ Serial.print("IP address: ");
+ Serial.println(WiFi.localIP()); //provides IP address
+ server.on("/", [](){
+ server.send(200, "text/html", page+page2);
+ });
+ server.on("/Forward",Forward);
+ server.on("/Backward",Backward);
+
+
+ server.on("/Stop",[](){ // turns all the motor input pins low
+ page2=" motor 1 Status : Off
";
+ server.send(200,"text/html",page+page2);
+ digitalWrite(D2,LOW);
+ digitalWrite(D1,LOW);
+ delay(200);
+ });
+ server.begin();
+ Serial.println("Web server started!");
+}
+void loop(void)
+{
+ server.handleClient();
+}
+
+ void Forward()
+ {
+ digitalWrite(D2,HIGH);
+ digitalWrite(D1,LOW);
+ page2=" motor 1 Status : Forward
";
+ server.send(200,"text/html", page+page2);
+ Serial.print('forward');
+ delay(200);
+ }
+
+ void Backward()
+ {
+ page2=" motor 1 Status : Backward
";
+ server.send(200, "text/html", page+page2);
+ digitalWrite(D1, HIGH);
+ digitalWrite(D2,LOW);
+ Serial.print('back');
+ delay(200);
+ }