I need help with my lcd selector system!

I want to make a lcd menu system using 3 buttons and a lcd but i can’t switch the other value once in a value!

Here is the code:

#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int backlightPin = 10;
int backlightBrightness = 255;
const int upPin = 8;
const int downPin = 7;
const int selectPin = 13;
int upState;
int downState;
int selectState;
int upS = 0;
int downS = 0;
int selectS = 0 ;
int Value1 = 64;
int Value2 = 100;
bool inMenu = true;
bool inValue = false;
char arrowpos = 0;
byte customChar = {
B10000,
B11000,
B11100,
B11110,
B11110,
B11100,
B11000,
B10000
};
byte customChar1 = {
B00100,
B01110,
B11111,
B00000,
B00000,
B11111,
B01110,
B00100
};
unsigned long previousMillis = 0;
unsigned long previousMillis1 = 0;

void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.createChar(1, customChar);
lcd.createChar(2, customChar1);
lcd.setCursor(0, 0);
lcd.write(1);
analogWrite(backlightPin, backlightBrightness);
pinMode(upPin, INPUT_PULLUP);
pinMode(downPin, INPUT_PULLUP);
pinMode(selectPin, INPUT_PULLUP);

}

void loop() {
// put your main code here, to run repeatedly:
upState = digitalRead(upPin);
downState = digitalRead(downPin);
selectState = digitalRead(selectPin);
unsigned long currentMillis = millis();
if (inMenu == true) {
if (upState == 0 && upS != 1 && inValue != true) {
upS = 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.write(1);
arrowpos = 0;
} else if (upState == 1){
upS=0;
}
if (downState == 0 && downS != 1 && inValue != true) {
downS = 1;
lcd.clear();
lcd.setCursor(0, 1);
lcd.write(1);
arrowpos = 1;
} else if (downState == 1){
downS=0;
}
if (arrowpos == 0 && selectState == 0 && selectS != 1) {
inValue = true;
selectS = 1;
lcd.setCursor(0, 0);
lcd.write(2);
}
if (arrowpos == 1 && selectState == 0 && selectS != 1) {
inValue = true;
selectS = 1;
lcd.setCursor(0, 1);
lcd.write(2);
}
if (inValue == true) {
if (arrowpos == 0) {
if (upState == 0 && inValue == true) {
if (currentMillis - previousMillis >= 200) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.write(2);
Value1++;
previousMillis = currentMillis;
}
} else if (selectState == 0 && selectS != 1) {
inValue = false;
lcd.setCursor(0, 0);
lcd.write(1);
}
if (downState == 0 && inValue == true) {
if (currentMillis - previousMillis >= 200) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.write(2);
Value1–;
previousMillis = currentMillis;
}
} else if (selectState == 0 && selectS != 1) {
inValue = false;
selectS = 1;
lcd.clear();
lcd.write(1);
}
}
if (arrowpos == 1) {
if (upState == 0 && inValue == true) {
if (currentMillis - previousMillis >= 200) {
lcd.clear();
lcd.setCursor(0, 1);
lcd.write(2);
Value2++;
previousMillis = currentMillis;
}
} else if (selectState == 0 && selectS != 1) {
selectS = 1;
inValue = false;
lcd.setCursor(0, 1);
lcd.write(1);
}
if (downState == 0 && inValue == true) {
if (currentMillis - previousMillis >= 200) {
lcd.clear();
lcd.setCursor(0, 1);
lcd.write(2);
Value2–;
previousMillis = currentMillis;
}
} else if (selectState == 0 && selectS != 1) {
selectS = 1;
inValue = false;
lcd.setCursor(0, 1);
lcd.write(1);
}
}
}
}

lcd.setCursor(1, 0);
lcd.print(“Value 1:”);
lcd.print(Value1);
lcd.setCursor(1, 1);
lcd.print(“Value 2:”);
lcd.print(Value2);
analogWrite(backlightPin, backlightBrightness);
if (selectState == 1 && selectS == 1) {
selectS = 0;
}
}

Hi, @yadefaulty
Welcome to the forum.

Please read the post at the start of any forum , entitled “How to use this Forum”.

To add code please click this link;

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :grinning: :+1: :coffee: :australia: