diff --git a/src/main.cpp b/src/main.cpp
index cba3f45..aebd841 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -38,7 +38,7 @@ int enable1Pin = 14;
const int freq = 30000;
const int pwmChannel = 0;
const int resolution = 8;
-int motorSpeed = 220; // motor speed, max 355
+int motorSpeed = 220; // motor speed, max 355
WebServer server(80);
@@ -132,7 +132,22 @@ const char* serverIndex =
"";
const char* movePage =
- "
";
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ "";
/*
* setup function
@@ -199,6 +214,30 @@ void setup(void) {
Serial.println("Motor Access");
server.send(200, "text/html", movePage);
});
+
+ server.on("/open", HTTP_GET, []() {
+ server.sendHeader("Connection", "close");
+ Serial.println("Opening");
+ digitalWrite(motor1Pin1, LOW);
+ digitalWrite(motor1Pin2, HIGH);
+ delay(3000);
+ // Stop the DC motor
+ digitalWrite(motor1Pin2, LOW);
+
+ server.send(200, "text/html", movePage);
+ });
+ server.on("/close", HTTP_GET, []() {
+ server.sendHeader("Connection", "close");
+ Serial.println("Closing");
+ digitalWrite(motor1Pin1, HIGH);
+ digitalWrite(motor1Pin2, LOW);
+ delay(3000);
+ // Stop the DC motor
+ digitalWrite(motor1Pin1, LOW);
+
+ server.send(200, "text/html", movePage);
+ });
+
server.on("/fwd", HTTP_GET, []() {
server.sendHeader("Connection", "close");
// Move the DC motor forward at maximum speed