Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ECE 445 UI repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aliceg3
ECE 445 UI repo
Commits
df7f56bc
Commit
df7f56bc
authored
2 years ago
by
aliceg3
Browse files
Options
Downloads
Patches
Plain Diff
button controls motors & pressure
parent
a880285f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arduino_code/test_webpage_sensors.ino
+28
-7
28 additions, 7 deletions
arduino_code/test_webpage_sensors.ino
with
28 additions
and
7 deletions
arduino_code/test_webpage_sensors.ino
+
28
−
7
View file @
df7f56bc
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide/
https://randomnerdtutorials.com/esp32-async-web-server-espasyncwebserver-library/
*********/
// Import required libraries
...
...
@@ -9,6 +8,8 @@
#include
<ESPAsyncWebServer.h>
#include
<AsyncTCP.h>
#include
<Stepper.h>
#include
<AccelStepper.h>
#include
<MultiStepper.h>
// Replace with your network credentials
const
char
*
ssid
=
"Connectify-ESP32 Boot"
;
...
...
@@ -28,6 +29,7 @@ const char* input_parameter2 = "state";
#define PRESSURE2GOAL 2034
Stepper
motor
(
200
,
motorIN1
,
motorIN2
,
motorIN3
,
motorIN4
);
//AccelStepper motor(AccelStepper::FULL4WIRE, motorIN1, motorIN2, motorIN3, motorIN4);
// current temperature & humidity, updated in loop()
int
pressure1
=
0.0
;
...
...
@@ -126,7 +128,7 @@ setInterval(function ( ) {
};
xhttp.open("GET", "/pressure1", true);
xhttp.send();
},
0.1
) ;
},
1000
) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
...
...
@@ -137,7 +139,7 @@ setInterval(function ( ) {
};
xhttp.open("GET", "/pressure1status", true);
xhttp.send();
},
0.1
) ;
},
1000
) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
...
...
@@ -148,7 +150,7 @@ setInterval(function ( ) {
};
xhttp.open("GET", "/pressure2", true);
xhttp.send();
},
0.1
) ;
},
1000
) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
...
...
@@ -159,7 +161,7 @@ setInterval(function ( ) {
};
xhttp.open("GET", "/pressure2status", true);
xhttp.send();
},
0.1
) ;
},
1000
) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
...
...
@@ -170,7 +172,7 @@ setInterval(function ( ) {
};
xhttp.open("GET", "/motor1status", true);
xhttp.send();
},
0.1
) ;
},
1000
) ;
</script>
</html>)rawliteral"
;
...
...
@@ -262,6 +264,25 @@ void setup(){
Serial
.
print
(
inputMessage1
);
Serial
.
print
(
" - Set to: "
);
Serial
.
println
(
inputMessage2
);
if
(
inputMessage2
.
toInt
()
==
1
){
motor1status
=
"running!!!"
;
// doesn't work idk why
// motor.setSpeed(120);
// motor.setCurrentPosition(0);
// motor.setAcceleration(10);
//
// motor.moveTo(2000);
//
// while(motor.distanceToGo() <= 1000) {
// motor.setSpeed(80);
// motor.runToPosition();
// }
motor
.
setSpeed
(
60
);
motor
.
step
(
500
);
motor
.
setSpeed
(
0
);
// motor1status = "motor stop";
}
request
->
send
(
200
,
"text/plain"
,
"OK"
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment