void firstMenu() {
  lcd.begin(20, 4);   // set up the LCD's number of columns and rows: 
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Manfreds lasercutter"); // Print a message to the LCD.
  lcd.setCursor(0, 1);
  lcd.print("Password?");
  lcd.setCursor(0, 2);
  lcd.print("Press * to confirm");
}
void menuPasswordReset(){
    lcd.setCursor(0, 4);
    lcd.print("     "); //empty "Wrong"
}
void menuPasswordWrong(){
          lcd.setCursor(0, 3);
    lcd.print("Wrong");
    }
void checkMenu() {
  if (menuType==1) {
    lcd.setCursor(0,0);
    lcd.print("Manfreds lasercutter");
    lcd.setCursor(0,1);
    lcd.print("press * for choices   ");
  } else {
    lcd.setCursor(0,0);
    lcd.print("press * for back    ");
    lcd.setCursor(0,1);
    lcd.print("1 air-assist 2 vent ");
    lcd.setCursor(0,2);
    lcd.print("3 watercool 4 laser ");
    lcd.setCursor(0,3);
    lcd.print("6 testmode 0 off 9 on          ");
  }
  char key = kpd.getKey();
}
void flowMenu(){
  if (menuType==1) {
    lcd.setCursor(0, 3);
    lcd.print("  Water");
    lcd.setCursor(11, 3);
    lcd.print(Calc, DEC); //Prints the number calculated abov
    lcd.print (" L/h "); //Prints "L/hour" a
  }  
}
void menuKeypadEvent(KeypadEvent eKey) {
  switch (kpd.getState()){
  case PRESSED:
    switch (eKey){
    case '*': 
      if (menuType==1) {
        menuType=2;
        lcd.clear();
      } else {
        menuType = 1;
        lcd.clear();
      }
      break;
    case '#': 
      password.reset(); 
      break;
    case  '9':
       digitalWrite(airAssistPin,   LOW);
       digitalWrite(ventilationPin, LOW);
       digitalWrite(waterCoolerPin, LOW);
       digitalWrite(laserEnablePin, LOW);
       digitalWrite(lichtPin, LOW);           // sets the licht pin  (inverted) on 
       digitalWrite(testEnablePin, HIGH);       // sets the test enable pin ()
       digitalWrite(potMeterEnable, HIGH);      // sets the watercooler fans on 
       break;
    case  '0':
       digitalWrite(airAssistPin,   HIGH);
       digitalWrite(ventilationPin, HIGH);
       digitalWrite(waterCoolerPin, HIGH);
       digitalWrite(laserEnablePin, HIGH);
       digitalWrite(lichtPin, HIGH);           // sets the licht pin  (inverted) on 
       digitalWrite(testEnablePin, HIGH);       // sets the test enable pin ()
       digitalWrite(potMeterEnable, HIGH);      // sets the watercooler fans off

       break;
    case  '1':
       digitalWrite(airAssistPin, !digitalRead(airAssistPin));
       break;
    case  '2':
       digitalWrite(ventilationPin, !digitalRead(ventilationPin));
       break;
    case  '3':
       digitalWrite(waterCoolerPin, !digitalRead(waterCoolerPin));
       break;
    case  '4':
       digitalWrite(laserEnablePin, !digitalRead(laserEnablePin));
       break;
    case  '5':
       digitalWrite(lichtPin, !digitalRead(lichtPin));
       break;  
    case  '6':
       digitalWrite(testEnablePin, !digitalRead(testEnablePin));
       digitalWrite(potMeterEnable, !digitalRead(potMeterEnable));
       break;
    case  '7':
       break;
    default: 
      password.append(eKey);
    }
  }
}
