#include <ESP32Servo.h>
Servo myServo;
int servoPin = 18;
void setup() {
// attach servo pin with a min/max timings of 500 microseconds and 2400 microseconds
myServo.attach(servoPin);
Serial.begin(115200);
}
// initialize position of 0 degrees
void loop() {
if(Serial.available()){
int angle = Serial.parseFloat();
myServo.write(angle);
}
delay(20);
}