#include <Keypad.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
//const uint8_t LEDS = 12;
const uint8_t ROWS = 4;
const uint8_t COLS = 4;
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
// Pins connected to LED1, LED2, LED3, ...LED12
//uint8_t ledPins[LEDS] = { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 28, 27 };
uint8_t rowPins[ROWS] = { 26, 22, 21, 20 }; // Pins connected to R1, R2, R3, R4
uint8_t colPins[COLS] = { 19, 18, 17, 16 }; // Pins connected to C1, C2, C3, C4
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup()
{
/*for (uint8_t l = 0; l < LEDS; l++)
{
pinMode(ledPins[l], OUTPUT);
digitalWrite(ledPins[l], LOW);
}*/
//lcd.begin(16, 2);
lcd.begin(20, 4);
lcd.setCursor(0, 0);
lcd.print("Dzien dobry!");
lcd.setCursor(0, 1);
lcd.print(".....");
}
void loop()
{
char key = keypad.getKey();
// CZAS //
unsigned long int time;
unsigned long int minuty;
byte sekundy;
byte setne;
//unsigned long int time0 = 0;
if (key!=NULL)
{
// CZAS //
time = millis();
minuty = time / 60000;
sekundy = (time / 1000) - 60 * minuty;
setne = time % 1000;
lcd.setCursor(0, 1);
lcd.print(key);
lcd.setCursor(0, 2);
lcd.print(time);
lcd.setCursor(0, 3);
lcd.print(minuty);
lcd.print("\'");
lcd.print(sekundy);
lcd.print("\"");
lcd.print(setne);
lcd.print(".");
}
delay(10);
}