da come vedi su...nel codice che ho postato uso la libreria Keypad.h
ho eseguito l esempio customkeypad(che poi ho riportato nel mio progetto)ho settato tutti i valori in base ai collegamenti che ho fatto ma non succede nulla sul display
hocapito xk non mi inserisce i valori..la tastiera che sto usando è mezza partita...infatti nel monitor seriale alcuni pulsanti non vanno..ho mandato a ritirare una tastiera a membrana 4x4 ..appena mi arriva mi rimetto al lavoro...
intanto non c'è nessuno che mi può aiutare con il codice?
ho levato i delay() dal loop ed inserito i millis() cosi è corretto?
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
int S = 5; // count seconds
int M = 0; // count minutes
int H = 0; // count hours
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] = {4, 3, 2, 1}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6, 5}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void Countdown(){
}
void Password(){
}
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
Serial.begin(9600);
lcd.backlight(); //noBlacklight per oscurare schermo
lcd.setCursor(4, 0);
lcd.print("S.M.A.S.");
lcd.setCursor(3, 1);
lcd.print("La Bombaaa!");
delay(5000);
lcd.clear();
}
void loop()
{
// lcd.clear(); // Start with a blank screen
lcd.setCursor(3, 0);
lcd.print ("Countdown!");
lcd.setCursor(6, 1);
lcd.print(":");
lcd.setCursor(9, 1);
lcd.print(":");
S--;
delay(1000);
if (S < 0)
{
lcd.setCursor(1, 0);
lcd.print("Tempo Scaduto");
lcd.setCursor(3, 1);
lcd.print("Sei Morto!");
for (int x = 0; x < 5000; x++) { // Wait for 1 second
delay(1);
}
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("Riavviare!");
lcd.setCursor(4, 1);
lcd.print("*SI #NO");
for (int x = 0; x < 100000; x++) { // Wait for 1 second
delay(1);
}
//lcd.clear();
}
if (M < 0)
{
H--;
M = 59;
}
if (H < 0)
{
H = 23;
M = 59;
S = 59;
}
if (M > 9)
{
lcd.setCursor(7, 1);
lcd.print(M);
}
else
{
lcd.setCursor(7, 1);
lcd.print("0");
lcd.setCursor(8, 1);
lcd.print(M);
lcd.setCursor(9, 1);
lcd.print(":");
}
if (S > 9)
{
lcd.setCursor(10, 1);
lcd.print(S);
}
else
{
lcd.setCursor(10, 1);
lcd.print("0");
lcd.setCursor(11, 1);
lcd.print(S);
lcd.setCursor(12, 1);
lcd.print(" ");
}
if (H > 9)
{
lcd.setCursor(4, 1);
lcd.print (H);
}
else
{
lcd.setCursor(4, 1);
lcd.print("0");
lcd.setCursor(5, 1);
lcd.print(H);
lcd.setCursor(6, 1);
lcd.print(":");
}
}