#include<LiquidCrystal.h>
int bot1 = 12, bot2 = 13;
int b1 = 0, b2 = 0;
int vm = 10 , vd = 11, am = 2;
int cbot = 0;
int pot;
int valor = 0;
int contador = 0;
int contrast = 75;
LiquidCrystal lcd (8, 9, 4, 5, 6, 7);
void setup()
{
analogWrite(3, contrast);
lcd.begin(16, 2);
delay(500);
pinMode(vd, OUTPUT);
pinMode(vm, OUTPUT);
pinMode(am, OUTPUT);
}
void loop ()
{
valor = analogRead(A0);
pot = valor/(1024.0/100);
lcd.setCursor(0, 0);
lcd.print("Bom dia.");
digitalWrite(vd, HIGH);
lcd.setCursor(0, 1);
lcd.print("Porcentagem:");
lcd.print(pot);
lcd.setCursor(15, 1);
lcd.print("%");
if(pot >= 90)
{
digitalWrite(am, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("MICC.") ;
lcd.setCursor(0, 1);
lcd.print("contagem:");
lcd.print(cbot);
contador++;
delay(1000);
}
if(digitalRead(bot1) == HIGH)
{
delay(100);
cbot = cbot + 1;
}
if(cbot >= 5)
{
digitalWrite(vm, HIGH);
}
}