#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins [ROWS] = { 9, 8, 7, 6};
byte colPins [COLS] = { 5, 4, 3, 2};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
const int buzzer = 12;
void setup() {
lcd.init();
lcd.backlight();
}
void loop() {
char safe = keypad.getKey();
if(safe != NO_KEY){
lcd.setCursor(0,1);
lcd.print(safe);
digitalWrite(buzzer, HIGH);
}
if (safe == 'C') {
lcd.clear();
}
}
/*
variable A = 1
variable B = 2
if (A == B) EQUALS
if (A != B) DOES NOT EQUAL
delay(1000);
lcd.noBacklight()
int a = 2
char b = 'C'
int: integer
int = 1
String: words, sentences
String myString = "this is a string"
String name = "Chris"
String city = "Atlantis"
String sentence = "hello, world"
bool: true/False values
bool skyIsRed = false;
bool skyIsBlue = true;
bool backlightEnabled = true;
bool doorIsOpen = false;
char: a single letter, digit, or symbol
char myLetter = "A"s
char thisIsACharacter = 'B'
byte: numbers from 0 to 255 (uses less memory than int)
*/