Saludos, perdón por la demora en responder, he estado algo ocupado.
El código que tengo es el siguiente:
#include <LiquidCrystal.h>
#include <Keypad.h>
#if 1
__asm volatile ("nop");
#endif
String strVersion = "V 1.0";
const int intPinLCDEncendido = 10;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {A5, A4, A3, A2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A1, A0, 2, 3}; //connect to the column pinouts of the keypad
Keypad kpd = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //pins del lcd
char minutos[10], segundos[10];
int led=13;
int motor=11;
const int boton=3;
int value = 0;
float minu = 0;
float seg = 0;
int minut = 0;
int segun = 0;
void setup() {
// put your setup code here, to run once:
pinMode (led, OUTPUT);
pinMode (motor, OUTPUT);
lcd.begin (16,2);
pinMode(boton, INPUT);
}
void loop() {
value = digitalRead(boton);
if (value == HIGH) {
lcd.noDisplay();
}
else {
lcd.display();
}
delay(300);
// put your main code here, to run repeatedly:
//SacaMensajeInicio()
{
lcd.clear();
lcd.print(F(" MI "));
lcd.setCursor(0, 1);
lcd.print(F("Incubadora "));
lcd.print(strVersion);
delay(3000);
lcd.clear();
lcd.print(F(" JC4D2G"));
lcd.setCursor(0, 1);
lcd.print(F("jc4d2g@gmail.com"));
delay(3000);
}
// PROGRAMACIÓN DE MINUTOS //
int i=0, j=0;
lcd.setCursor (1,0);
lcd.print ("TECLEA MINUTOS");
lcd.setCursor (6,1);
for (i=0;i<=1;i++)
{
minutos[i]=kpd.waitForKey();
lcd.print (minutos);
lcd.clear();
lcd.setCursor (1,0);
lcd.print ("TECLEA MINUTOS");
lcd.setCursor (6,1);
lcd.print (minutos);
}
// PROGRAMACIÓN DE SEGUNDOS //
delay (500);
float minu=atoi(minutos);
lcd.clear ();
lcd.setCursor(0,0);
lcd.print ("TECLEA SEGUNDOS");
lcd.setCursor (6,1);
for (j=0;j<=1;j++)
{
segundos[j]=kpd.waitForKey();
lcd.print (segundos);
lcd.clear();
lcd.setCursor (0,0);
lcd.print ("TECLEA SEGUNDOS");
lcd.setCursor (6,1);
lcd.print (segundos);
}
delay (500);
float seg=atoi(segundos);
lcd.clear();
while(i)
{
lcd.clear();
segun++;
if (segun >=59)
{
minut++;
segun =0;
}
lcd.setCursor (1,0);
lcd.write ("CONTEO");
lcd.setCursor (0,4);
if (minut<10) lcd.print (" 0");
lcd.print (minut);
if (segun<10) lcd.print (" 0");
lcd.print (segun);
delay (1000);
if (segun >= seg && minut >= minu)
{
while (i)
{
lcd.clear();
lcd.setCursor (1,0);
lcd.write ("CONTEO");
lcd.setCursor (0,4);
lcd.write (" TERMINADO");
// ENCENDER O APAGAR EL LED Y EL MOTOR //
digitalWrite (led, HIGH);
delay (300);
digitalWrite (led, LOW);
delay (300);
digitalWrite (motor, HIGH);
delay (1000);
}
}
}
}