#define COUNT_LOW 2400 #define COUNT_HIGH 8500 #define SERVO_CHANNEL 5 #define TIMER_WIDTH 16 #include "esp32-hal-ledc.h" void setup() { ledcSetup(1, 50, TIMER_WIDTH); ledcAttachPin(SERVO_CHANNEL,1); } void loop() { for (int i = COUNT_LOW; i < COUNT_HIGH; i+=20) { ledcWrite(1, i); delay(10); } for (int i = COUNT_HIGH; i > COUNT_LOW+100; i-=20) { ledcWrite(1, i); delay(10); } }