#include <ESP32Servo.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(22,23,5,18,19,21);
const int servoPin_1 = 2;
const int servoPin_2 = 4;
Servo servo_1;
Servo servo_2;
void setup()
{
{
lcd.begin(16,2);
servo_1.attach(2, 500, 2500);
servo_2.attach(4, 500, 2500);
lcd.begin(16, 2);// Inicializar la LCD con 16 columnas y 2 filas
lcd.clear();// Limpiamos la pantalla
lcd.setCursor(0, 0);// Colocamos el cursor en la columna 0 fila 0
lcd.print("Servomotor"); // Primera fila Servomotor
lcd.setCursor(0, 1);// Configurar el contenido en la columna 0 fila 1
lcd.print("giro180grados"); // Segunda fila giro180grados}
}
}
void loop() {
for (int pow = 0; pow <= 180; pow += 1){
servo_1.write(pow);
delay(15);
}
for (int pow = 180; pow >= 0; pow -= 1){
servo_2.write(pow);
delay(15);
}
for (int pow = 180; pow >= 0; pow -= 1){
servo_1.write(pow);
delay(15);
}
for (int pow = 0; pow <= 180; pow += 1){
servo_1.write(pow);
delay(15);
}
}