#include <ESP32Servo.h>;
Servo servo;
const int servoPin = 22;
const int botsel = 15; //pin do botão
int est_bot = 0; //estado do botão
int pos = 0;
const int abrir = 2;
const int fechar = 4;
int b_abrir = 0;
int b_fechar = 0;
int s_t = 0;
const int sensor_temp = 34;
const int autom = 18;
const int manual = 19;
int aux_abertura = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(sensor_temp, INPUT);
pinMode(abrir, INPUT);
pinMode(fechar, INPUT);
pinMode(botsel, INPUT);
pinMode(autom, OUTPUT);
pinMode(manual, OUTPUT);
servo.attach(servoPin, 500, 2400);
}
void loop() {
est_bot = digitalRead(botsel);
if(est_bot == HIGH) {
digitalWrite(manual, HIGH);
digitalWrite(autom, LOW);
} else {
digitalWrite(manual, LOW);
digitalWrite(autom, HIGH);
}
}