#include <Wire.h>
#include <DHT.h>
#include <ESP32Servo.h>
Servo Servo1;
const int btn2 = 12;
const int btn1 = 13;
int deg = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Servo1.attach(14);
pinMode(btn1, INPUT);
pinMode(btn2, INPUT);
}
void loop() {
int press1 = digitalRead(btn1);
if (press1 == HIGH){
deg = deg + 1;
if (deg > 180){
deg = 180;
}
}
delay(30);
int press2 = digitalRead(btn2);
if (press2 == HIGH){
deg = deg - 1;
if (deg < 0){
deg = 0;
}
}
delay(30);
Servo1.write(deg);
}