You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
415 B

#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);
}
}