Hi all I'm making a simple program to control a camera slider it's in very early development stage so don't judge I'm keeping it as simple as possible as I'm completely new to Arduino just trying to get to grips with the programming.
basically I have a int that controls the multiplication factor for when a button is pushed to increment the value of another int.
It works fine but my if statement seems to be failing it should look back to 1 when it reaches 5 but instead it loops back to 2. I'm sure it must be a problem with the flow of my code but I haven't been able to identify where. the function in question is at the bottom and called multiply.
I've checked in the serial monitor and the int does loop back to 1 but for some reason it doesn't actually set the multiplier back to 1. Hope that makes sense.
Any help would be greatly appreciated, I'll dump my code below.
#include <LiquidCrystal.h>
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;// custom pin out for my LCD!!!
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int Total_time = 0;
int Exp_time = 0;
int Step_time = 0;
int NoExp = 0;
int NoSteps = 0;
int Step_range = 0;
int hours = 0;
int mins = 0;
int MenuNo = 1;
int multipliers = 1;
int mult = 1;
void setup() {
 Serial.begin(9600);
 lcd.begin(16, 2);
 lcd.setCursor(1, 0);
// lcd.print("Welcome to my");
 lcd.setCursor(1, 1);
 //lcd.print("camera slider");
 //delay(3000);
 lcd.clear();
 lcd.setCursor(1, 0);
// lcd.print("Enter timelapse");
 lcd.setCursor(4, 1);
 //lcd.print("type");
 delay(2000);
 lcd.clear();
 MenuItems();
}
void loop() {
 Buttons();
}
void Buttons(){
int x;
x = analogRead (0);
Â
  if (x < 80){
    Â
     delay(200);
    // lcd.print("right key");
    serialtest();
    if (MenuNo == 1){
      Total_time = Total_time + multipliers;
      hours = Total_time /60;
      mins = Total_time % 60;
      MenuItems();
     }else if (MenuNo == 2){
      Exp_time = Exp_time + multipliers;
      MenuItems();
     }else if (MenuNo == 3){
      NoExp = NoExp + multipliers;
      MenuItems();
     }else if (MenuNo == 4){
      Step_time = Step_time + multipliers;
      MenuItems();
     }
     Â
  Â
 }else if (x < 200){
  Â
     delay(200);
     //lcd.print("up key");
  if (MenuNo >0 && MenuNo < 7){
     MenuNo ++;
     MenuItems();
  }  Â
  Â
 } else if (x < 400){
    Â
     delay(200);
     //lcd.print("down key");
  if (MenuNo >0 && MenuNo < 7){
     MenuNo --;
     MenuItems();
    Â
   } Â
 Â
 }else if (x < 600){
    Â
     delay(200);
     //lcd.print("left key");
     mult++;
     multiply();
     MenuItems();
     if (MenuNo == 1){
     }
     if (MenuNo == 2){
    Â
     }
     if (MenuNo == 3){
    Â
     }
     if (MenuNo == 4){
    Â
     }
      Â
  Â
 }else if (x < 800){
   Â
     delay(400);
     //lcd.print("select key");
    if (MenuNo == 1){
    Â
 Â
     }
Â
   }Â
}
void MenuItems(){
if (MenuNo == 1){
  Â
   lcd.clear();
   lcd.print("Run time");
   lcd.setCursor(13,0);Â
   lcd.print(multipliers);
   lcd.setCursor(11,0);
   lcd.print("X");
   lcd.setCursor(0,1);
   lcd.print("Time : ");
   lcd.setCursor(7,1);
   lcd.print(Total_time);
   lcd.setCursor(7,1);
   lcd.print(hours);
   lcd.print(":");  Â
   lcd.print(mins);
  Â
 }else if (MenuNo == 2){
   lcd.clear();
   lcd.print("Exposure time");
   lcd.setCursor(14,1);Â
   lcd.print(multipliers);
   lcd.setCursor(13,1);
   lcd.print("X");Â
   lcd.setCursor(0,1);
   lcd.print("Time : ");
   lcd.setCursor(7,1);
   lcd.print(Exp_time);
  Â
 }else if (MenuNo == 3){
   lcd.clear();
   lcd.print("# exp");
   lcd.setCursor(14,1);Â
   lcd.print(multipliers);
   lcd.setCursor(13,1);
   lcd.print("X"); ;Â
   lcd.setCursor(0,1);
   lcd.print("# : ");
   lcd.setCursor(7,1);
   lcd.print(NoExp);
  Â
 }else if (MenuNo == 4){
   lcd.clear();
   lcd.clear();
   lcd.clear();
   lcd.print("Run time");Â
   lcd.setCursor(0,1);
   lcd.print("Time : ");
   lcd.setCursor(7,1);
   lcd.print(Total_time);
   Â
  Â
 }else if (MenuNo == 5){
   lcd.clear();
   lcd.clear();
   lcd.clear();
   lcd.print("Run time");Â
   lcd.setCursor(0,1);
   lcd.print("Time : ");
   lcd.setCursor(7,1);
   lcd.print(Total_time);
  Â
 }else if (MenuNo == 6){
   lcd.clear();
   lcd.clear();
   lcd.clear();
   lcd.print("Start shot");Â
}
}
void multiply(){Â Â
Â
   if (mult == 1){
    multipliers = 1;
    }
    else if (mult == 2){
    multipliers = 5;
    }
    else if (mult == 3){
    multipliers = 10;
    }
    else if (mult == 4){
    multipliers = 15;
    }
    else if (mult == 5){
    multipliers = 30;
    }
    if (mult < 1){
     mult = 5;
    }else if (mult > 5) {
     mult = 1;
 }
}
void serialtest (){
   Serial.print("hours : ");
   Serial.println(hours);
   Serial.print("mins : ");
   Serial.println(mins);
   Serial.print("total time : ");
   Serial.println(Total_time);
   Serial.print("# exp : ");
   Serial.println(NoExp);
   Serial.print("exp time : ");
   Serial.println(Exp_time);
 }