I need help with this very basic coding

I’m new to coding and made a code that works fine but I wanted to add an option to interupt the process with the start button. I figured out that I nned to use millis() but seems not to work.

I would be very thankfull if someone could help me with my newbi stupid question :frowning:

I spend hours searching the web but only found stupid blinking LED samples with millis() and I might missunderstood something :confused:

Tried to do the first If (Jack Daniels pure) with millis() and that it would stop if the start button is pressed:

#include <LiquidCrystal.h>
#include "Arduino.h"

LiquidCrystal lcd(7,6,5,4,3,2);

const int pumpe1Pin=8;
const int pumpe2Pin=9;
const int ventilPin=10;

const int smallButtonSensor=11;
const int bigButtonSensor=12;
const int liquorSwitchSensor=13;

unsigned long lastTime = 0;
unsigned long currentTime;
unsigned long period = 5000;


void setup() {

  currentTime = millis();
  lastTime = currentTime;
  
  lcd.begin(16,2);
  
  lcd.print("GetsYouDrunk PRO");
  
  delay(20);

  
  lcd.setCursor(0,1);
  lcd.print("Reading...");
  
  delay(40);

  
  lcd.begin(16,2);
  
  lcd.print("Select liquor:");
}

void loop() {

  currentTime = millis();
  
  pinMode(pumpe1Pin,OUTPUT);
  pinMode(pumpe2Pin,OUTPUT);
  pinMode(ventilPin,OUTPUT);  
  
  int liquorSensorVal=digitalRead(liquorSwitchSensor);
  int smallButtonVal=digitalRead(smallButtonSensor);
  int bigButtonVal=digitalRead(bigButtonSensor);
  
  digitalWrite(pumpe1Pin, LOW);
  digitalWrite(pumpe2Pin, LOW);
  digitalWrite(ventilPin, LOW);
  
  
  
  if(liquorSensorVal==HIGH){
    Serial.println("Liquor 1 selected");
    
    lcd.setCursor(0,0);
    lcd.print("Select liquor:");
    lcd.setCursor(0,1);
    lcd.print("Jack Daniel's  ");
  }  
  
  
  if((smallButtonVal==HIGH)&&(liquorSensorVal==HIGH)){     //Jack Daniels Pure
      digitalWrite(pumpe1Pin, HIGH);
  
    lcd.begin(16,2);
    lcd.print("Processing");
    lcd.setCursor(0,1);
    lcd.print("Jack pure...");

    delay(5);

    if(currentTime - lastTime >= period){
      digitalWrite(pumpe1Pin, LOW);
      }
	if(smallButtonVal==HIGH){
      digitalWrite(pumpe1Pin, LOW);
    
    }
    
  }
       
    

   if((bigButtonVal==HIGH)&&(liquorSensorVal==HIGH)){     //Jack Daniels Coke
      digitalWrite(pumpe1Pin, HIGH);
      digitalWrite(ventilPin, HIGH);
    
    lcd.begin(16,2);
    lcd.print("Processing");
    lcd.setCursor(0,1);
    lcd.print("Jack & Coke...");
    
    delay(8500);
    digitalWrite(pumpe1Pin, LOW);
    delay(10000);
    digitalWrite(ventilPin, LOW);         
   }
   
    delay(1);
  
  if(liquorSensorVal==LOW){
    Serial.println("Liquor 2 selected");
    
    lcd.setCursor(0,0);
    lcd.print("Select liquor:");
    lcd.setCursor(0,1);
    lcd.print("Captain Morgan  ");
  }
   
  if((smallButtonVal==HIGH)&&(liquorSensorVal==LOW)){       // Captain Morgan Pure
      digitalWrite(pumpe2Pin, HIGH);
    
    lcd.begin(16,2);
    lcd.print("Processing");
    lcd.setCursor(0,1);
    lcd.print("Captain pure...");
    
    delay(6500);
    
    digitalWrite(pumpe2Pin, LOW);
  }
    
    
  if((bigButtonVal==HIGH)&&(liquorSensorVal==LOW)){      //Captain Morgan Coke
      digitalWrite(pumpe2Pin, HIGH);
      digitalWrite(ventilPin, HIGH);
    
    lcd.begin(16,2);
    lcd.print("Processing");
    lcd.setCursor(0,1);
    lcd.print("Captain & Coke...");
  
    delay(6500);
    digitalWrite(pumpe2Pin, LOW);
    delay(10000);
    digitalWrite(ventilPin, LOW); 
    } 
    
    delay(1);
}

millis() and delay() are usually a futile combination when used together. It usually means giving up any advantages that millis() conveys.

    if (currentTime - lastTime >= period) //period has ended.  Time to do something

OK so far but you never set lastTime to currentTime again to start the next timing period.

But there is worse to come in your code

    delay(8500);

    delay(10000);

What are these and other long delays doing in your code ? They will mess up your millis() timing even if you do it right. Don't mix the two.

thanks for the answers! I want to exchange all the delay() functions into millis(). The first is just a try. Should be in the end all with millis() :slight_smile:

Your program looks like it is in one of several states at any one time. It remains in some of these states for fixed times, as when you currently use delay(), and other states end when user input is received.

If this is the case than you have a classic "state machine". List all of the states that the program could be in, what starts each one, what ends each one, such as time or an input, and the next state that the program moves on to.

This will give you the basis of implementing the state machine in your program probably, using switch/case based on the current state. Using switch/case and millis() for timing allows you to ensure only code for the current state is executed but allows loop() to run freely so that the program is responsive to inputs.

I googled a while about switch/case but it will probably not work if I want to use the same button to stop as for starting.

Yes should be a state machine which checks in a loop for the different states of buttons and will produce the work/block given. I just cant't figure out how to stop the procedure with the same button as you would have it in a coffee machine. You push a button and if you want to abort the procedure before the given normal time ends, it will abort the procedure. :sob:

almost desperate the hours i googled for such a simple thing

it will probably not work if I want to use the same button to stop as for starting.

It will if you write it correctly.

Imagine a system with only 2 states, ON and OFF
When in state ON one block of code runs
When in state OFF a second block of code runs
Controlled by switch/case

Read the button input each time through loop(). Remember, No blocking code in the program
When the button becomes pressed and you are in state ON, change to state OFF
When the button becomes pressed and you are in state OFF, change to state ON

Behold ! A single button with two purposes

made the first "case" of the switch variant. Looks like something went already wrong with the millis() and tried several hours and googleing but can't figure out what it is...

when running the code, it will start the pump just for about 100 milliseconds

const int smallButtonSensor=11;
const int bigButtonSensor=12;
const int liquorSwitchSensor=13;

const long timeJack=2000;

unsigned long lastTimePushed=0;




void setup() {

  
  lcd.begin(16,2);
  
  lcd.print("GetsYouDrunk PRO");
  
  delay(200);

  
  lcd.setCursor(0,1);
  lcd.print("Reading...");
  
  delay(400);

  
  lcd.begin(16,2);
  
  lcd.print("Select liquor:");
}

void loop() {

  
  
  pinMode(pumpe1Pin,OUTPUT);
  pinMode(pumpe2Pin,OUTPUT);
  pinMode(ventilPin,OUTPUT);  
  
  int liquorSensorVal=digitalRead(liquorSwitchSensor);
  int smallButtonVal=digitalRead(smallButtonSensor);
  int bigButtonVal=digitalRead(bigButtonSensor);
  
  digitalWrite(pumpe1Pin, LOW);
  digitalWrite(pumpe2Pin, LOW);
  digitalWrite(ventilPin, LOW);
  
  
  
  if(liquorSensorVal==HIGH){
    lcd.setCursor(0,0);
    lcd.print("Select liquor:");
    lcd.setCursor(0,1);
    lcd.print("Jack Daniel's  ");
    }  
  if(liquorSensorVal==LOW){
    lcd.setCursor(0,0);
    lcd.print("Select liquor:");
    lcd.setCursor(0,1);
    lcd.print("Captain Morgan");
    }
  

    
  switch(liquorSensorVal==HIGH){
  	
  		case 1:
    		if(smallButtonVal==HIGH){
    		  lastTimePushed=millis();
    		  digitalWrite(pumpe1Pin, HIGH);
            }
    
    		else if(millis() > lastTimePushed + timeJack){
      		  digitalWrite(pumpe1Pin, LOW);
            }   
      
  		break; 
    	
  		
  }	
  }

When the button becomes pressed and you are in state ON, change to state OFF
When the button becomes pressed and you are in state OFF, change to state ON

Where is the code that detects the change of state of the button ?

  pinMode(pumpe1Pin, OUTPUT);
  pinMode(pumpe2Pin, OUTPUT);
  pinMode(ventilPin, OUTPUT);

Why do this each time through loop() ?
Once is enough

UKHeliBob:
Where is the code that detects the change of state of the button ?

switch(liquorSensorVal==HIGH){
  	
  		case 1:
    		if(smallButtonVal==HIGH){

[/quote]
Why do this each time through loop() ?
Once is enough[/quote]

my thought was if there happens something wrong, it will set everything to the beginning and none of the pumps will run unwillingly in such a case

if(smallButtonVal==HIGH){That detects the the button is pressed (assuming that HIGH means pressed), not that has become pressed.

Look at the StateChangeDetection example in the IDE to see how to do it.

my thought was if there happens something wrong, it will set everything to the beginning and none of the pumps will run unwillingly in such a case

Setting the pinMode() does not change the state of a pin.

UKHeliBob:
if(smallButtonVal==HIGH){That detects the the button is pressed (assuming that HIGH means pressed), not that has become pressed.

Look at the StateChangeDetection example in the IDE to see how to do it.
Setting the pinMode() does not change the state of a pin.

Stupid me. Was still mind setted on the previous version working with delay. Works now! Thank you very much!

Although I have a problem with flickering LCD because it updates the request in the loop of course. I couldn’t come up with another solution…the part of “Processing Pure Jack” flickers, but the idle part doesn’t. A little strange. Would be great if you could point me in the right direction :slight_smile: Thanks a lot!

Here’s the code (Text for “Coke”-Process is not yet implemented):

#include <LiquidCrystal.h>
#include "Arduino.h"

LiquidCrystal lcd(7,6,5,4,3,2);

const int pumpe1Pin=8;
const int pumpe2Pin=9;
const int pumpeLuftPin=10;

const int smallButton=11;
const int bigButton=12;
const int liquorSwitch=13;

boolean pumpeOn = false;						//For State Changement

const long timeJack = 500;						//Time for pumps running
const long timeCaptain = 500;
const long timeCoke = 1000;

unsigned long previousMillis = 0;




void setup() {

  
  lcd.begin(16,2);							//Starting sequence on LCD
  lcd.print("GetsYouDrunk PRO");
  
  delay(200);

  lcd.setCursor(0,1);
  lcd.print("Reading...");
  
  delay(400);

  lcd.begin(16,2);
  lcd.print("Select liquor:");
  
  
  pinMode(pumpe1Pin,OUTPUT);
  pinMode(pumpe2Pin,OUTPUT);
  pinMode(pumpeLuftPin,OUTPUT);
  
  digitalWrite(pumpe1Pin, LOW);
  digitalWrite(pumpe2Pin, LOW);
  digitalWrite(pumpeLuftPin, LOW);
}


void loop() { 
  
  int liquorSensorVal=digitalRead(liquorSwitch);
  int smallButtonVal=digitalRead(smallButton);
  int bigButtonVal=digitalRead(bigButton);
  int statePumpe1=digitalRead(pumpe1Pin);
  int statePumpe2=digitalRead(pumpe2Pin);
  int statePumpeLuft=digitalRead(pumpeLuftPin);
  
  unsigned long currentMillis = millis();
  
  
  
  if((liquorSensorVal==HIGH)&&(statePumpe1==LOW)){		//If in idle
    lcd.setCursor(0,0);
    lcd.print("Selected liquor:");
    lcd.setCursor(0,1);
    lcd.print("Jack Daniel's  ");
  }
    
  if((liquorSensorVal==LOW)&&(statePumpe2==LOW)){		//If in idle
    lcd.setCursor(0,0);
    lcd.print("Selected liquor:");
    lcd.setCursor(0,1);
    lcd.print("Captain Morgan  ");    		       
  }     
    
  
  
  
    switch (liquorSensorVal==HIGH) {                        //Jack Daniel's
    
    	case 1:                                             	                   //Pure
        	if(smallButtonVal==HIGH){
         		delay(5);
         		pumpeOn = !pumpeOn;
        		previousMillis=millis();
         	}

    		digitalWrite(pumpe1Pin, pumpeOn);
      
      		if(statePumpe1 == HIGH){
              	lcd.begin(16,2);
    			lcd.print("Processing");
   				lcd.setCursor(0,1);
   				lcd.print("Jack Pure...");
            }
      		            
        	if(currentMillis > previousMillis + timeJack){
        	    digitalWrite(pumpe1Pin, LOW);
            }   
    	break; 
      
      
      
    	case 2:                                                                  //With coke
        	if(bigButtonVal==HIGH){
          		delay(5);
          		pumpeOn = !pumpeOn;
          		previousMillis=millis();
          	}

    		digitalWrite(pumpe1Pin, pumpeOn);
    		digitalWrite(pumpeLuftPin, pumpeOn);
      
        	if(currentMillis > previousMillis + timeJack){
            	digitalWrite(pumpe1Pin, LOW);
            }   
       		if(currentMillis > previousMillis + timeCoke){
            	digitalWrite(pumpeLuftPin, LOW);
            }
    	break; 
    } 
      		
  
    
      
  switch (liquorSensorVal==LOW){              			//Captain Morgan
    
    	case 1:                       			  			//Pure
      		if(smallButtonVal==HIGH){
          		delay(5);
          		pumpeOn = !pumpeOn;
         		previousMillis=millis();
          	}

    		digitalWrite(pumpe2Pin, pumpeOn);
    
    		if(statePumpe2 == HIGH){
              	lcd.begin(16,2);
    			lcd.print("Processing");
    			lcd.setCursor(0,1);
    			lcd.print("Captain Pure...");
            }
    
        	if(currentMillis > previousMillis + timeCaptain){
           		digitalWrite(pumpe2Pin, LOW);
            }   
    	break;  
    
    
    
    	case 2:                                                          //With coke
        	if(bigButtonVal==HIGH){
          		delay(5);
          		pumpeOn = !pumpeOn;
          		previousMillis=millis();
          	}

    		digitalWrite(pumpe2Pin, pumpeOn);
    		digitalWrite(pumpeLuftPin, pumpeOn);
      
        	if(currentMillis > previousMillis + timeJack){
            	digitalWrite(pumpe2Pin, LOW);
            }   
       		if(currentMillis > previousMillis + timeCoke){
            	digitalWrite(pumpeLuftPin, LOW);
            }
    	break; 
      }
  }

the part of "Processing Pure Jack" flickers, but the idle part doesn't.

      if (statePumpe1 == HIGH)
      {
        lcd.begin(16, 2);
        lcd.print("Processing");
        lcd.setCursor(0, 1);
        lcd.print("Jack Pure...");
      }

Take out the lcd.begin();
You only need to do that once in setup() and note that you don't do it in the "idle" section

UKHeliBob:

      if (statePumpe1 == HIGH)

{
        lcd.begin(16, 2);
        lcd.print("Processing");
        lcd.setCursor(0, 1);
        lcd.print("Jack Pure...");
      }



Take out the lcd.begin();
You only need to do that once in setup() and note that you don't do it in the "idle" section

Also, you want to do that when the pump state BECOMES HIGH, NOT when the pump state IS HIGH.

Back to the examples. This time, the state change detection example.

UKHeliBob:

      if (statePumpe1 == HIGH)

{
       lcd.begin(16, 2);
       lcd.print(“Processing”);
       lcd.setCursor(0, 1);
       lcd.print(“Jack Pure…”);
     }



Take out the lcd.begin();
You only need to do that once in setup() and note that you don't do it in the "idle" section

works now perfectly with the display! Wow you guys are awesome! Thanks again :slight_smile:

But facing now the problem that each “case 2” is not working. If I delete “case 1”, “case 2” is working. Weird. Maybe I still don’t get the case of working with switch/case. :’(

newest code:

#include <LiquidCrystal.h>
#include "Arduino.h"

LiquidCrystal lcd(7,6,5,4,3,2);

const int pumpe1Pin=8;
const int pumpe2Pin=9;
const int pumpeLuftPin=10;

const int smallButton=11;
const int bigButton=12;
const int liquorSwitch=13;

boolean pumpeOn = false;            //For State Changement

const long timeJack = 5000;            //Time for pumps running
const long timeCaptain = 5000;
const long timeCoke = 9000;

unsigned long previousMillis = 0;




void setup() {

  
  lcd.begin(16,2);                //Starting sequence on LCD
  lcd.print("GetsYouDrunk PRO");
  
  delay(200);

  lcd.setCursor(0,1);
  lcd.print("Reading...");
  
  delay(400);

  lcd.begin(16,2);
  lcd.print("Selected liquor:");
  
  
  pinMode(pumpe1Pin,OUTPUT);
  pinMode(pumpe2Pin,OUTPUT);
  pinMode(pumpeLuftPin,OUTPUT);
  
  digitalWrite(pumpe1Pin, LOW);
  digitalWrite(pumpe2Pin, LOW);
  digitalWrite(pumpeLuftPin, LOW);
}


void loop() { 
  
  int liquorSensorVal=digitalRead(liquorSwitch);
  int smallButtonVal=digitalRead(smallButton);
  int bigButtonVal=digitalRead(bigButton);
  int statePumpe1=digitalRead(pumpe1Pin);
  int statePumpe2=digitalRead(pumpe2Pin);
  int statePumpeLuft=digitalRead(pumpeLuftPin);
  
  unsigned long currentMillis = millis();
  
  
  
  if((liquorSensorVal==HIGH)&&(statePumpe1==LOW)){          //If in idle
    lcd.setCursor(0,0);
    lcd.print("Selected liquor:");
    lcd.setCursor(0,1);
    lcd.print("Jack Daniel's  ");
  }
    
  if((liquorSensorVal==LOW)&&(statePumpe2==LOW)){         //If in idle
    lcd.setCursor(0,0);
    lcd.print("Selected liquor:");
    lcd.setCursor(0,1);
    lcd.print("Captain Morgan  ");               
  }     
    
  
  
  
  switch (liquorSensorVal==HIGH) {                        //Jack Daniel's
    
      case 1:                                               //Pure
          if(smallButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
          }

          digitalWrite(pumpe1Pin, pumpeOn);
      
          if(statePumpe1 == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Jack Pure...   ");
            }
                      
          if(currentMillis > previousMillis + timeJack){
              digitalWrite(pumpe1Pin, LOW);
            }   
      break; 
      
      
      
      case 2:                                                 //With coke
          if(bigButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
            }

          digitalWrite(pumpe1Pin, pumpeOn);
          digitalWrite(pumpeLuftPin, pumpeOn);
      
          if(statePumpeLuft == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Jack & Coke... ");
            }
      
          if(currentMillis > previousMillis + timeJack){
              digitalWrite(pumpe1Pin, LOW);
            }   
          if(currentMillis > previousMillis + timeCoke){
              digitalWrite(pumpeLuftPin, LOW);
            }
      break; 
    } 
          
      

    
      
  switch (liquorSensorVal==LOW){                    //Captain Morgan
    
      case 1:                                     //Pure
          if(smallButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
          }

          digitalWrite(pumpe2Pin, pumpeOn);
    
          if(statePumpe2 == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Captain Pure... ");
          }
    
          if(currentMillis > previousMillis + timeCaptain){
              digitalWrite(pumpe2Pin, LOW);
          }   
      break;  
    
    
    
      case 2:                                                 //With coke
          if(bigButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
            }

          digitalWrite(pumpe2Pin, pumpeOn);
          digitalWrite(pumpeLuftPin, pumpeOn);
    
          if(statePumpeLuft == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Captain & Coke... ");
            }
      
          if(currentMillis > previousMillis + timeJack){
              digitalWrite(pumpe2Pin, LOW);
            }   
          if(currentMillis > previousMillis + timeCoke){
              digitalWrite(pumpeLuftPin, LOW);
            }
      break; 
      }
  }

But facing now the problem that each "case 2" is not working.

Post the code as it is now

UKHeliBob:
Post the code as it is now

modified my last post before :slight_smile:

just in case here it is again:

#include <LiquidCrystal.h>
#include "Arduino.h"

LiquidCrystal lcd(7,6,5,4,3,2);

const int pumpe1Pin=8;
const int pumpe2Pin=9;
const int pumpeLuftPin=10;

const int smallButton=11;
const int bigButton=12;
const int liquorSwitch=13;

boolean pumpeOn = false;            //For State Changement

const long timeJack = 5000;            //Time for pumps running
const long timeCaptain = 5000;
const long timeCoke = 9000;

unsigned long previousMillis = 0;




void setup() {

  
  lcd.begin(16,2);                //Starting sequence on LCD
  lcd.print("GetsYouDrunk PRO");
  
  delay(200);

  lcd.setCursor(0,1);
  lcd.print("Reading...");
  
  delay(400);

  lcd.begin(16,2);
  lcd.print("Selected liquor:");
  
  
  pinMode(pumpe1Pin,OUTPUT);
  pinMode(pumpe2Pin,OUTPUT);
  pinMode(pumpeLuftPin,OUTPUT);
  
  digitalWrite(pumpe1Pin, LOW);
  digitalWrite(pumpe2Pin, LOW);
  digitalWrite(pumpeLuftPin, LOW);
}


void loop() { 
  
  int liquorSensorVal=digitalRead(liquorSwitch);
  int smallButtonVal=digitalRead(smallButton);
  int bigButtonVal=digitalRead(bigButton);
  int statePumpe1=digitalRead(pumpe1Pin);
  int statePumpe2=digitalRead(pumpe2Pin);
  int statePumpeLuft=digitalRead(pumpeLuftPin);
  
  unsigned long currentMillis = millis();
  
  
  
  if((liquorSensorVal==HIGH)&&(statePumpe1==LOW)){          //If in idle
    lcd.setCursor(0,0);
    lcd.print("Selected liquor:");
    lcd.setCursor(0,1);
    lcd.print("Jack Daniel's  ");
  }
    
  if((liquorSensorVal==LOW)&&(statePumpe2==LOW)){         //If in idle
    lcd.setCursor(0,0);
    lcd.print("Selected liquor:");
    lcd.setCursor(0,1);
    lcd.print("Captain Morgan  ");               
  }     
    
  
  
  
  switch (liquorSensorVal==HIGH) {                        //Jack Daniel's
    
      case 1:                                               //Pure
          if(smallButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
          }

          digitalWrite(pumpe1Pin, pumpeOn);
      
          if(statePumpe1 == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Jack Pure...   ");
            }
                      
          if(currentMillis > previousMillis + timeJack){
              digitalWrite(pumpe1Pin, LOW);
            }   
      break; 
      
      
      
      case 2:                                                 //With coke
          if(bigButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
            }

          digitalWrite(pumpe1Pin, pumpeOn);
          digitalWrite(pumpeLuftPin, pumpeOn);
      
          if(statePumpeLuft == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Jack & Coke... ");
            }
      
          if(currentMillis > previousMillis + timeJack){
              digitalWrite(pumpe1Pin, LOW);
            }   
          if(currentMillis > previousMillis + timeCoke){
              digitalWrite(pumpeLuftPin, LOW);
            }
      break; 
    } 
          
      

    
      
  switch (liquorSensorVal==LOW){                    //Captain Morgan
    
      case 1:                                     //Pure
          if(smallButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
          }

          digitalWrite(pumpe2Pin, pumpeOn);
    
          if(statePumpe2 == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Captain Pure... ");
          }
    
          if(currentMillis > previousMillis + timeCaptain){
              digitalWrite(pumpe2Pin, LOW);
          }   
      break;  
    
    
    
      case 2:                                                 //With coke
          if(bigButtonVal==HIGH){
              delay(100);
              pumpeOn = !pumpeOn;
              previousMillis=millis();
            }

          digitalWrite(pumpe2Pin, pumpeOn);
          digitalWrite(pumpeLuftPin, pumpeOn);
    
          if(statePumpeLuft == HIGH){
              lcd.setCursor(0,0);
              lcd.print("Processing      ");
              lcd.setCursor(0,1);
              lcd.print("Captain & Coke... ");
            }
      
          if(currentMillis > previousMillis + timeJack){
              digitalWrite(pumpe2Pin, LOW);
            }   
          if(currentMillis > previousMillis + timeCoke){
              digitalWrite(pumpeLuftPin, LOW);
            }
      break; 
      }
  }
 switch (liquorSensorVal == HIGH)

What are the possible values of liquorSensorVal == HIGH ?

You have 2 cases in the switch/case, 1 and 2

Bearing in mind the answer to the question above which case or cases will be executed ?

It makes possible to switch between two liquors. Switching works on the machine.

creygelz:
It makes possible to switch between two liquors. Switching works on the machine.

I repeat, what are the possible values of liquorSensorVal == HIGH ?