#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
pinMode(2, INPUT_PULLUP);
}
int menu;
void loop() {
// put your main code here, to run repeatedly:
if(menu==0){
lcd.setCursor(0,0);
lcd.print("menu 1");
}
if(menu ==1){
if(hlod(3))menu=0;
lcd.setCursor(0,0);
lcd.print("menu 2");
}
if(menu==2){
if(hlod(3))menu=0;
lcd.setCursor(0,0);
lcd.print("menu 3");
}
if(digitalRead(2)==0){
menu++;
delay(150);
}
}
void dly_ms(int d){
int i,j;
for(i=0;i<d;i++)for(j=0;j<120;j++);
}
int cntr=0;
int hlod(int timer){
cntr++;dly_ms(1);
if(cntr>timer*100){
return 1;
}
else return 0;
}