/*
* Modder: @red9030
* Title: SERVO ESP
* Reference:
*/
/*
*****************************************************
* LIBRERIAS
*****************************************************
*/
#include <ESP32Servo.h>
/*
*****************************************************
* VARIABLES
*****************************************************
*/
const int servoPin = 18;
Servo servo;
int pos = 0;
/*
*****************************************************
* INICIO
*****************************************************
*/
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
servo.attach(servoPin, 500, 2400);
Serial.println("Hello, ESP32!");
}
/*
*****************************************************
* REPETICIÓN
*****************************************************
*/
void loop() {
for (pos = 0; pos <= 180; pos += 1) {
servo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) {
servo.write(pos);
delay(15);
}
}
/*
*****************************************************
* FUNCIONES
*****************************************************
*/