#include <ESP32Servo.h>
#define SERVO_PIN 9  // Connect the servo signal line to A0 of UNOR4 MINIMA
Servo myServo;        // Instantiate a steering gear object

void setup() {
  pinMode(SERVO_PIN, OUTPUT);  // Set the servo connected pin to output mode
  myServo.attach(SERVO_PIN);   // Set the steering gear object
}

void loop() {
  // Let the steering gear turn from 180 to 0 degrees
  for (int angle = 180; angle >= 0; angle--) {
    myServo.write(angle);
    delay(10);
  }

  // Let the steering gear turn from 0 to 180 degrees
  for (int angle = 0; angle <= 180; angle++) {
    myServo.write(angle);
    delay(10);
  }
}