Hello, for the past days i have been trying to create an interactive menu with a 1602 lcd without a l2c circuit.
The goal is to have a menu that is navigatable and has sections wich i can click on with the built in pushbutton on the rotary encoder.
For some reason my code isnt working and i have no idea why... Does anyone spot any errors that i missed?
Thanks.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int inputCLK = 9;
const int inputDT = 8;
const int buttonPin = 7;
int clickState = 0;
int mode = 0;
int show = 0;
int counter = 0;
int currentStateCLK;
int previousStateCLK;
void setup() {
Â
 lcd.begin(0,1);
 lcd.setCursor(1,0);
Â
 pinMode (inputCLK,INPUT);
 pinMode (inputDT,INPUT);
Â
 Serial.begin (9600);
Â
 previousStateCLK = digitalRead(inputCLK);
}
void loop() {
Â
 currentStateCLK = digitalRead(inputCLK);
  modeCheck();Serial.print(show);
  showCheck();Serial.print(" ");
 Â
 if (currentStateCLK != previousStateCLK){
  Â
  if (digitalRead(inputDT) != currentStateCLK) {
  show ++;
  } else {
  show --;
  }
 }
 previousStateCLK = currentStateCLK;
}
void modeCheck() {
 if(mode == 0){
  lcd.clear();
  lcd.print("Main menu");
  mode = 1;
  }
 if(mode == 1) {Â
  if(digitalRead(buttonPin) == LOW) {
   lcd.clear();
   lcd.print("listening");
    mode = 2;
    show = 1; Â
   }
  }
 }
void showCheck() {
 if(mode == 2) {
 Â
  if(show == 1){
    lcd.clear();
    lcd.print("Programm1");
   Â
    if(digitalRead(buttonPin) == LOW) {
     delay(2000);
     mode = 1;
    }
   }
  Â
  if(show == 2){  Â
    lcd.clear();
    lcd.print("Programm2");
   Â
    if(digitalRead(buttonPin) == LOW) {     Â
     delay(2000);
     mode = 1;
    }
   }
  Â
  if(show == 3){   Â
    lcd.clear();
    lcd.print("Programm3");
    if(digitalRead(buttonPin) == LOW) {     Â
     delay(2000);
     mode = 1;
    }
   }
  }
  if(show > 3) {show = 1;}
  if(show <1) {show = 3;}
 }