#include <LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
byte character[8] = {
B11111,
B10101,
B10101,
B11111,
B10101,
B10101,
B11111,
};
void setup() {
Serial.begin(9600);
//CERVENY BUTTON
pinMode(7, INPUT);
digitalWrite(7, HIGH);
//MODRY BUTTON
pinMode(6, INPUT);
digitalWrite(6, HIGH);
//ZLTY BUTTON
pinMode(5, INPUT);
digitalWrite(5, HIGH);
//SEDY BUTTON
pinMode(4, INPUT);
digitalWrite(4, HIGH);
lcd.begin(20,4);
lcd.createChar(0, character);
lcd.setCursor(1,3);
lcd.write(byte(0));
}
bool t1=true;
bool t2=true;
bool t3=true;
bool t4=true;
int col=1;
int row=3;
void loop() {
//CERVENY
if(digitalRead(7) == LOW && t1 == true)
{
t1=false;
if(row-1 != -1) row--;
lcd.clear();
lcd.setCursor(col,row);
lcd.write(byte(0));
}
if(digitalRead(7) == HIGH) t1=true;
//MODRY
if(digitalRead(6) == LOW && t2==true)
{
t2=false;
if(row+1 != 4) row++;
lcd.clear();
lcd.setCursor(col,row);
lcd.write(byte(0));
}
if(digitalRead(6) == HIGH) t2=true;
//ZLTY
if(digitalRead(5) == LOW && t3==true)
{
t3=false;
if(col-1 != -1) col--;
lcd.clear();
lcd.setCursor(col,row);
lcd.write(byte(0));
}
if(digitalRead(5) == HIGH) t3= true;
//SEDY
if(digitalRead(4) == LOW && t4 == true)
{
t4=false;
if(col+1 != 20) col++;
lcd.clear();
lcd.setCursor(col,row);
lcd.write(byte(0));;
}
if(digitalRead(4) == HIGH) t4= true;
}