#include <ESP32Servo.h>
const int ledPin = 16;
const int freq = 5000;
const int ledChannel = 0;
const int resolution = 8;
const uint8_t btnPin = 2;
Servo myservo;
float pos = 0.0; // Variable where the arm's position will be stored (in degrees)
float step = 1.0; // Variable used for the arm's position step
int servoPin = 16;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
myservo.setPeriodHertz(50); // standard 50 hz servo
myservo.attach(servoPin, 500, 200);
}
void loop() {
pos += 10;
myservo.write(pos);
Serial.println(pos);
if (pos > 120) {
pos = 0;
}
}