/*
Simple Test "WOKWI simulates Servo Control"
Whith increasing delays between servo steps
the simulation of the servo movement begins
to wiggle when moving clockwise.
Counterclockwise there is an effect of stopping
visible, but not the wiggle effect (servo moving
back and forth during the angular movement)
written by ec2021
2023-02-27
*/
#include "ESP32Servo.h"
const int servoPin = 14;
Servo servo;
void setup() {
Serial.begin(115200);
Serial.println("Start");
servo.attach(servoPin);
servo.write(90);
}
void Move(int Delay, int From, int To){
Serial.print("Delay Time =\t");
Serial.println(Delay);
if (From < To) {
for (int i = From;i < To;i++){
servo.write(i);
delay(Delay);
}
} else {
for (int i = From;i > To;i--){
servo.write(i);
delay(Delay);
}
}
}
void loop() {
Move(10,90,180);
Move(10,180,90);
Move(50,90,180);
Move(50,180,90);
Move(100,90,180);
Move(100,180,90);
Move(150,90,180);
Move(150,180,90);
}