#include <ESP32Servo.h>
Servo servo0;
Servo servo1;
int pos1 = 0;
int pos2 = 0;
void setup() {
Serial.begin(9600);
servo0.attach(D0);
servo1.attach(D1);
servo0.write(0);
servo1.write(0);
}
void loop() {
if (Serial.available() > 0) {
int servoNumber = Serial.parseInt();
int inputAngle = Serial.parseInt();
if (servoNumber == 0 && inputAngle = 0 && inputAngle <= 180) {
pos1 = inputAngle;
servo0.write(pos1);
Serial.println(pos1);
} else if (servoNumber == 1 && inputAngle = 0 && inputAngle <= 180) {
pos2 = inputAngle;
servo1.write(pos2);
Serial.println(pos2);
}
}
}