Is it possible that some kind of update may have affected servos from working with Nano ESP32 modules? I'm going nuts trying to figure out why all my servos suddenly stopped working. I tested the servos with Raspberry Pi 5, which work fine, but no batter what I try, they will no longer with any of the Arduino Nano ESP32 modules I have (I tried 3). I also tried a couple of other ESP32 servo libraries just to be sure that a code change in the library I was using (ESP32Servo by Kevin Harrington) wasn't causing the problem, but the other ESP32 servo libraries I tried did not work either. I am testing the modules in the simplest way on a breadboard, and have tested all the connections and voltages with a VOM. I also tried using different pins for the PWM signal, to no avail. And the servo is getting the proper voltage from a power supply, the grounds between power supply, Nano, and servo are connected together, and the Nano is powered via USB-C from Windows computer. I'm on v2.3.6 of the Arduino IDE. Here is one basic sketch I'm using. I've also tried esp32-hal-ledc. If you have any thoughts, please mention them as I am going out of my mind why this stopped working! Thanks much for any help!
#include <ESP32Servo.h>
Servo myservo;
int pos = 0;
int servoPin = 4;
void setup() {
// Allow allocation of all timers
ESP32PWM::allocateTimer(0);
ESP32PWM::allocateTimer(1);
ESP32PWM::allocateTimer(2);
ESP32PWM::allocateTimer(3);
myservo.setPeriodHertz(50); // standard 50 hz servo
myservo.attach(servoPin, 1000, 2000);
}
void loop() {
myservo.write(0);
delay(1000);
myservo.write(45);
delay(1000);
myservo.write(90);
delay(1000);
}