Hello! I'm using an ESP32-S3 to control four electronic speed controllers and two servo motors. They all operate off PWM signals. I'm using a servo library to generate them. I currently have two controllers hooked up and they seem to work fine by themselves but as soon as I uncomment the line attaching another servo motor(s) nothing works. I think this could be because of the limitations of multiple PWM signal generations from the ESP32-S3 because previously when I had the other ESC attached to a different pin it wouldn't work. What do you think?
#include <ESP32Servo.h>
Servo esc3; //Create a servo object to control the ESC. (Servo signal is PWM, same as ESC)
Servo esc4;
Servo servo1;
Servo servo2;
void setup() {
//Serial.begin(115200);
//servo1.attach(15);
//servo2.attach(18);
esc3.attach(6);
esc3.writeMicroseconds(1000); // Send minimum throttle signal to the ESC
esc4.attach(8);
esc4.writeMicroseconds(1000);
delay(3000); //Wait for the ESC to calibrate
}
void loop() {
//SERVO CAL
/*
int val = analogRead(17);
val = map(val, 0, 4095, 0, 180);
servo1.write(val);
Serial.println(val);
*/
//Change the value between 1000 (minimum throttle) and 2000 (maximum throttle) to control the speed
esc3.writeMicroseconds(2000); // Set the throttle signal to the middle position for medium speed
esc4.writeMicroseconds(2000); // Set the throttle signal to the middle position for medium speed
delay(5000); // Keep the speed for 5 seconds
esc3.writeMicroseconds(1000); // Set the throttle signal to the middle position for medium speed
esc4.writeMicroseconds(1000); // Set the throttle signal to minimum to stop the motor
delay(5000);
}