//#include <Servo.h>
#include <ESP32Servo.h>
Servo motor1; // DECLARAR SERVO 1
int grados1 = 0; // GRADOS DEL SERVO 1
int LED_BUILTIN=15;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
motor1.attach (33); // PIN D0 DONDE ESTÁ CONECTADO EL SERVO 1
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(800); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(800); // wait for a second
grados1 = 0;
motor1.write (grados1); // ENVIAR LOS GRADOS AL SERVO 1
delay(1000); // ESPERA 1 SEGUNDO EN LA POSICIÓN FIJADA
grados1 = 180;
motor1.write (grados1);
delay(6000);
grados1 = 0;
motor1.write (grados1);
delay(1000);
}