Fixed up ESP32 Web server
This commit is contained in:
25
src/main.cpp
Normal file
25
src/main.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <Arduino.h>
|
||||
#include <Servo.h>
|
||||
|
||||
static const int servoPin = 4;
|
||||
|
||||
Servo servo1;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
servo1.attach(servoPin);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
for(int posDegrees = 0; posDegrees <= 180; posDegrees++) {
|
||||
servo1.write(posDegrees);
|
||||
Serial.println(posDegrees);
|
||||
delay(20);
|
||||
}
|
||||
|
||||
for(int posDegrees = 180; posDegrees >= 0; posDegrees--) {
|
||||
servo1.write(posDegrees);
|
||||
Serial.println(posDegrees);
|
||||
delay(20);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user