#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C LCD(0x27, 16, 2);
#include <ESP32Servo.h>
const int servoPin = 16;
int posGraus = 0;
int botao = 2;
int y =0;
Servo servoMotor;
byte grau[]={
B00000,
B00111,
B00101,
B00111,
B00000,
B00000,
B00000, };
void setup() {
pinMode(botao, INPUT);
Serial.begin(115200);
servoMotor.attach(servoPin);
LCD.init();
LCD.backlight();
LCD.setCursor(0, 0);
LCD.print(" SENAI CFP 1.01 ");
LCD.setCursor(0, 1);
LCD.print(" TEC. MECATRONICA ");
delay(1000);
LCD.clear();
}
void loop() {
bool x=digitalRead(botao);
servoMotor.write(posGraus);
LCD.setCursor(0, 0);
LCD.print("botao: ");
LCD.print(y);
LCD.setCursor(0, 1);
LCD.print("Motor: ");
LCD.print(posGraus);
if(x==HIGH)
{
posGraus=posGraus+10;
y++;
delay(500);
}
}