#include <ESP32Servo.h>
Servo servo_1;
Servo servo_2;
Servo servo_3;
void setup()
{
Serial.begin(9600);
pinMode(4, INPUT); pinMode(2, INPUT);
servo_1.attach(18, 500, 2500);
servo_2.attach(5, 500, 2500);
servo_3.attach(19, 500, 2500);
servo_1.write(0); servo_2.write(0); servo_3.write(0);
//long tiempo= millis;
}
void loop()
{
servo_1.write(map(analogRead(2), 0, 4095, 0, 179)); //horizontal;
Serial.print(analogRead(2)); Serial.print(" ");
delay(100);
/*
if(analogRead(19) > 515)
{
servo_1.write(random(90,120));
delay(200);
}
if(analogRead(21) < 500)
{
servo_2.write(random(0,90));
delay(300);
}
if(analogRead(21) > 515)
{
servo_1.write(random(0,90));
servo_2.write(random(45,90));
servo_3.write(random(90,10));
delay(500);
} */
}