#include <LiquidCrystal.h>
LiquidCrystal lcd = LiquidCrystal(13,12,7,6,5,4);
bool test = true;
bool test2 = true;
bool test3 = true;
int cislo = 0;
int oa = 0;
int na = 0;
int ta =0;
int tlacidlo = 0;
String MENU[]= {"Osobne ","Nakladne ","Taxi "};
void setup()
{
lcd.begin(16,2);
pinMode(A5, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
}
void loop()
{ // tlacidlo menu hore
if (digitalRead(A5) == LOW && test == true)
{
test = false;
if(cislo < 2)
{
cislo++;
}
}
else if (digitalRead(A5) == HIGH && test == false)
{
test = true;
}
// tlacidlo menu dole
if (digitalRead(A4) == LOW && test2 == true)
{
test2 = false;
if(cislo > 0)
{
cislo--;
}
}
else if (digitalRead(A4) == HIGH && test2 == false)
{
test2 = true;
}
// tlacidlo +1
if (digitalRead(A3) == LOW && test3 == true)
{
test3 = false;
tlacidlo=1;
}
else if (digitalRead(A3) == HIGH && test3 == false)
{
test3 = true;
}
switch (cislo) {
case 0:
if(tlacidlo==1){
oa++;
tlacidlo=0;
}
lcd.home();
lcd.print(MENU[cislo]);
lcd.print(oa);
lcd.print(" ");
break;
case 1:
if(tlacidlo==1){
na++;
tlacidlo=0;
}
lcd.home();
lcd.print(MENU[cislo]);
lcd.print(na);
lcd.print(" ");
break;
case 2:
if(tlacidlo==1){
ta++;
tlacidlo=0;
}
lcd.home();
lcd.print(MENU[cislo]);
lcd.print(ta);
lcd.print(" ");
break;
}
}