'void' does not name type

Hi Everyone !
I wish to display a lcd bargraph for liquid level. The code does not compile gives an error ‘Void’ does not name type.
This is the first problem I am facing, I know there are lot more waiting…
Kindly help me =(

//includes
#include <LiquidCrystal.h>
#include <EEPROM.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,6,7,8,9) when LCD is used
//pins
const byte buttonpin1 = 2; // reed switch 1
const byte buttonpin2 = 3; // reed switch 2
const byte buttonpin3 = 4; // reed switch 3
const byte buttonpin4 = 5; // reed switch 4
const byte buttonpin5 = 5; // reed switch 5

byte state1 = 0; 
byte state2 = 0;
byte state3 = 0;
byte state4 = 0;
byte state5 = 0;
int Level = 0;

void setup() { 
//configure pins   
pinMode(buttonpin1, INPUT);
pinMode(buttonpin2, INPUT);
pinMode(buttonpin3, INPUT);
pinMode(buttonpin4, INPUT);
pinMode(buttonpin5, INPUT);
//setup LCD, when lcd used
lcd,begin (16,2);
//intitial message

lcd.SetCursor (0,0);
lcd.print ("Hello");
Level = EEPROM.read(0); // read level value from eeprom.

//Recalling the Level from eeprom 
lcd.setCursor (0,1);
lcd.print ("Last level: ");
lcd.print (Level);
delay(5000); 
lcd.clear();

// Create custom characters to make a ramp
byte clrChar[8] = { // character needed to clear others
	B00000,
	B00000,
	B00000,
	B00000,
	B00000,
	B00000,
	B00000,
	B00000
};
lcd.createChar(0, clrChar);
byte newChar[8] = { // // black character 
	B11111,
	B11111,
	B11111,
	B11111,
	B11111,
	B11111,
	B11111,
	B11111
};

lcd.createChar(1, newChar);
} // end setup()


// the display a single function called from inside loop 
Void display() { 
  
switch (Level) {
case 1:
state1 = 0;state2 = 1;state3 = 1;state4 = 1;state4 = 1;
lcd.setCursor(0, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(1, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(2, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(3, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(4, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(6, 0); // set cursor position.
lcd.print("MIN");// write text next to graph
break;
case 2:
state1 = 0;state2 = 0;state3 = 1;state4 = 1;state4 = 1;
lcd.setCursor(0, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(1, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(2, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(3, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(4, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(6, 0); // set cursor position.
lcd.print("25%");// write text next to graph
break;
case3:
state1 = 0;state2 = 0;state3 = 0;state4 = 1;state4 = 1;
lcd.setCursor(0, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(1, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(2, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(3, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(4, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(6, 0); // set cursor position.
lcd.print("50%");// write text next to graph
break;

case4:
state1 = 0;state2 = 0;state3 = 0;state4 = 0;state4 = 1;
lcd.setCursor(0, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(1, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(2, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(3, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(4, 0); // set cursor position.
lcd.write(0); // write to screen the custom clear character.
lcd.setCursor(6, 0); // set cursor position.
lcd.print("75%");// write text next to graph
break;
case5:
state1 = 0;state2 = 0;state3 = 0;state4 = 0;state4 = 0;
lcd.setCursor(0, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(1, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(2, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(3, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(4, 0); // set cursor position.
lcd.write(1); // write to screen the custom graph character.
lcd.setCursor(6, 0); // set cursor position.
lcd.print("MAX%”";// write text next to graph
break;

default: 
      // if nothing else matches, do the default
      // default is optional
  }
}

void loop(){

display();  // display is called at everyloop and at beginning of it. 
So at first time will restore the Display and states from the Level stored at eeprom.

if (digitalRead(buttonpin1) == LOW){ // min
int state1= digitalRead(buttonpin1);
Level=1;
delay(500);  // debounce
}
 if (digitalRead(buttonpin2) == LOW) // 25%
 {
 state2 = !state2;  // toggle state
 if (state2 >0 ){ 
Level = 2;
if (state2 ==0 ){ 
Level =1;
}
delay(500);  // debounce
 }
if (digitalRead(buttonpin3) == LOW) //50%
{
 state3 = !state3;  // toggle state
if (state3 >0 ){ 
Level = 3;
}
if (state3 ==0 ){ 
Level = 2;
}
 delay(500);  // debounce
 }
if (digitalRead(buttonpin4) == LOW) // 75%
{
state4 = !state4;  // toggle state
 if (state4 >0 ){ 
Level = 4;
}
if (state4 ==0 ){ 
Level = 3;
}
delay(500);  // debounce
 }
if (digitalRead(buttonpin5) == LOW) { // max
state5 = !state5;  // toggle state
Level = 5;
// CUT POWER SUPPLY TO PUMP.
delay(500);  // debounce
 }
if (digitalRead(buttonpin5) == HIGH) {  // max reed off
state5 = !state5;  // toggle state
if (state5>1) {
Level = 4; 
}
delay(500);  // debounce
 }
EEPROM.write(0, Level); // Write to eeprom memory position 0 the Level value.
delay(100); // small delay at each loop.
 }
Void display() {

It's "void" not "Void".

Also check your parentheses, if you do an "auto format" it says "Too many left parentheses".

Also this isn't valid C:

LiquidCrystal lcd(12,11,6,7,8,9) when LCD is used

There should be a semicolon after the brackets, and are you missing a comment there?

Thanks Mr. Nick
The sketch is compiled with your valuable instructions.
When buttonpin1 is activated it displays the black character and MIN in the lcd. it is OK
but No further displays when the other button pins are activated.
I wish to display
2 black charactors and 25% when buttonpin2 is activated
3 black charactors and 50% when buttonpin3 is activated
4 black charactors and 75% when buttonpin3 is activated
5 black charactors and Max% when buttonpin5 is activated

What could be the problem?

Can you post the revised sketch please?

Mr. Nick
Here is revised sketch Sir.

//includes
#include <LiquidCrystal.h>
#include <EEPROM.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,5,4,3,2); //when LCD is used
//pins
const byte buttonpin1 = 7; // reed switch 1
const byte buttonpin2 = 8; // reed switch 2
const byte buttonpin3 = 9; // reed switch 3
const byte buttonpin4 = 10; // reed switch 4
const byte buttonpin5 = 13; // reed switch 5
byte state1 = 0; 
byte state2 = 0;
byte state3 = 0;
byte state4 = 0;
byte state5 = 0;
int Level = 0;

void setup() { 
//configure pins   

  pinMode(buttonpin1, INPUT);
  pinMode(buttonpin2, INPUT);
  pinMode(buttonpin3, INPUT);
  pinMode(buttonpin4, INPUT);
  pinMode(buttonpin5, INPUT);
  //setup LCD, when lcd used
  lcd.begin (16,2);
  //intitial message

  lcd.setCursor (0,0);
  lcd.print ("Hello");
 Level = EEPROM.read(0); // read level value from eeprom.

  //Recalling the Level from eeprom you need to fix graph again and states.
  lcd.setCursor (0,1);
  lcd.print ("Last level: ");
  lcd.print (Level);
  delay(5000); 
  lcd.clear();

  // Create custom characters to make a ramp
  byte clrChar[8] = { // character needed to clear others
    B00000,
    B00000,
    B00000,
    B00000,
    B00000,
    B00000,
    B00000,
    B00000
  };
 lcd.createChar(0, clrChar);

byte newChar[8] = { // // black character 
    B11111,
    B11111,
    B11111,
    B11111,
    B11111,
    B11111,
    B11111,
    B11111
  };
 lcd.createChar(1, newChar);
} // end setup()

//This make the display a single function called from inside loop simplifying // the code to fix graph and states.

void display() { 
switch (Level) {
  case 1:
    state1 = 0;
    state2 = 1;
    state3 = 1;
    state4 = 1;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(1, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(2, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(3, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(4, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("MIN");// write text next to graph
    break;
  case 2:
    state1 = 0;
    state2 = 0;
    state3 = 1;
    state4 = 1;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(1, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(2, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(3, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(4, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("25%");// write text next to graph
    break;
case3:
    state1 = 0;
    state2 = 0;
    state3 = 0;
    state4 = 1;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(1, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(2, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(3, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(4, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("50%");// write text next to graph
    break;

case4:
    state1 = 0;
    state2 = 0;
    state3 = 0;
    state4 = 0;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(1, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(2, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(3, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(4, 0); // set cursor position.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("75%");// write text next to graph
    break;
case5:
    state1 = 0;
    state2 = 0;
    state3 = 0;
    state4 = 0;
    state4 = 0;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(1, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(2, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(3, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(4, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("MAX%”");// write text next to graph
    break;

    //default: 
    // if nothing else matches, do the default
    // default is optional
  }
}

void loop(){
display();  // display is called at everyloop and at beginning of it. 
  //So at first time will restore the Display and states from the Level stored at eeprom.
 if (digitalRead(buttonpin1) == LOW){ // min
    int state1= digitalRead(buttonpin1);
    Level=1;
    delay(500);  // debounce
  }
 if (digitalRead(buttonpin2) == LOW) // 25%
 {
    state2 = !state2;  // toggle state
    if (state2 >0 ){ 
      Level = 2;
      if (state2 ==0 ){ 
        Level =1;
      }
      delay(500);  // debounce
 }
  if (digitalRead(buttonpin3) == LOW) //50%

    {
 state3 = !state3;  // toggle state
  if (state3 >0 ){ 
   Level = 3;
      }
if (state3 ==0 ){ 
    Level = 2;
      }
  delay(500);  // debounce
}
 if (digitalRead(buttonpin4) == LOW) // 75%
{
 state4 = !state4;  // toggle state
 if (state4 >0 ){ 
 Level = 4;
  }
 if (state4 ==0 ){ 
  Level = 3;
      }
 delay(500);  // debounce
     }
 if (digitalRead(buttonpin5) == LOW) { // max
      state5 = !state5;  // toggle state
      Level = 5;
      // CUT POWER SUPPLY TO PUMP.
      delay(500);  // debounce
     }
if (digitalRead(buttonpin5) == HIGH) {  // max reed off
      state5 = !state5;  // toggle state
      if (state5>1) {
        Level = 4; 
      }
delay(500);  // debounce
}
 EEPROM.write(0, Level); // Write to eeprom memory position 0 the Level value.

 // delay(100); // small delay at each loop.
 } 
}
    lcd.setCursor(0, 0); // set cursor position.

lcd.write(1); // write to screen the custom graph character.
   lcd.setCursor(1, 0); // set cursor position.
   lcd.write(0); // write to screen the custom clear character.
   lcd.setCursor(2, 0); // set cursor position.
   lcd.write(0); // write to screen the custom clear character.
   lcd.setCursor(3, 0); // set cursor position.
   lcd.write(0); // write to screen the custom clear character.
   lcd.setCursor(4, 0); // set cursor position.
   lcd.write(0); // write to screen the custom clear character.
   lcd.setCursor(6, 0); // set cursor position.
   lcd.print(“MIN”);// write text next to graph

Doesn’t doing a write advance the cursor? Can’t this just be:

    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("MIN");// write text next to graph

Or even:

    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); 
    for (byte i = 0; i < 4; i++)
      lcd.write(0); 
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("MIN");// write text next to graph

Ditto for the other cases.


case3:

That is not the same as:

case 3:

Ditto for case4, and case5.


    if (digitalRead(buttonpin3) == LOW) //50%

Do you have pull-up resistors on all these pins?


  if (digitalRead(buttonpin2) == LOW) // 25%

{
   state2 = !state2;  // toggle state
   if (state2 >0 ){
     Level = 2;
     if (state2 ==0 ){
       Level =1;
     }
     delay(500);  // debounce
   }
   if (digitalRead(buttonpin3) == LOW) //50%

{
  …
   }
   if (digitalRead(buttonpin4) == LOW) // 75%
   {
    …
   }
   if (digitalRead(buttonpin5) == LOW) { // max
   …
   }
   if (digitalRead(buttonpin5) == HIGH) {  // max reed off
    …
   }
   EEPROM.write(0, Level); // Write to eeprom memory position 0 the Level value.

// delay(100); // small delay at each loop.
 }

You just threw in a squiggly bracket to make the compiler error go away didn’t you? It’s in the wrong place. All those other ifs are under the first if. So if buttonpin2 is not pressed it doesn’t test them.


    EEPROM.write(0, Level); // Write to eeprom memory position 0 the Level value.

You should read some of the recent threads about EEPROM writing. The EEPROM has a life of about 100,000 writes. You will wear it out in a couple of seconds. Try only writing to it if the level changes, or perhaps only every minute or so (or both).

I have corrected the "case" problem

Do you have pull-up resistors on all these pins?

10K pull up resistors are connected to all these pins

You will wear it out in a couple of seconds. Try only writing to it if the level changes, or perhaps only every minute or so (or both).

I have done a blunder. Can you help me to write the EEPROM writes for this sketch ?

Hello there !

This code displays the levels 25%,50%,Min,75% without activating the buttonpins with time delay and Level Max is missing.It does not display coressponding to the states of the button pins. There is no effect in the displays even the buttonpins are switched ON or OFF.

I am writing to the EEPROM the state of the levels. Is it because of EEPROM write or something else ??
Please help !!

#include <LiquidCrystal.h>
#include <EEPROM.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,5,4,3,2); //when LCD is used//pins

const byte buttonpin1 = 6; // reed switch 1
const byte buttonpin2 = 7; // reed switch 2
const byte buttonpin3 = 8; // reed switch 3
const byte buttonpin4 = 9; // reed switch 4
const byte buttonpin5 = 10; // reed switch 5

byte state1 = 0; 
byte state2 = 0;
byte state3 = 0;
byte state4 = 0;
byte state5 = 0;
int Level = 0;
void setup() { 
 //configure pins   
  pinMode(buttonpin1, INPUT);
  pinMode(buttonpin2, INPUT);
  pinMode(buttonpin3, INPUT);
  pinMode(buttonpin4, INPUT);
  pinMode(buttonpin5, INPUT);

  //setup LCD, when lcd used

  lcd.begin (16,2);

  //intitial message

  lcd.setCursor (0,0);
  lcd.print ("Hello Arduino");

  Level = EEPROM.read(0); // read level value from eeprom.
  //Recalling the Level from eeprom .

  lcd.setCursor (0,1);
  lcd.print ("Last level: ");
  lcd.print (Level);
  delay(5000); 
  lcd.clear();

  // Create custom characters to make a ramp
  byte clrChar[8] = { // character needed to clear others
    B00000,
    B00000,
    B00000,
    B00000,
    B00000,
    B00000,
    B00000,
    B00000
  };
  lcd.createChar(0, clrChar);

 byte newChar[8] = { // // black character 
    B11111,
    B11111,
    B11111,
    B11111,
    B11111,
    B11111,
    B11111,
    B11111
  };
 lcd.createChar(1, newChar);
}
 
//Make the display a single function called from inside loop simplifying // the code to fix graph and states.

  void display() { 
  switch (Level) {
  case 1:
    state1 = 0;
    state2 = 1;
    state3 = 1;
    state4 = 1;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("MIN");// write text next to graph
    break;
  case 2:
    state1 = 0;
    state2 = 0;
    state3 = 1;
    state4 = 1;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("25%");// write text next to graph
    break;
  case 3:
    state1 = 0;
    state2 = 0;
    state3 = 0;
    state4 = 1;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("50%");// write text next to graph
    break;

  case 4:
    state1 = 0;
    state2 = 0;
    state3 = 0;
    state4 = 0;
    state4 = 1;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(0); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("75%");// write text next to graph
    break;
  case 5:
    state1 = 0;
    state2 = 0;
    state3 = 0;
    state4 = 0;
    state4 = 0;
    lcd.setCursor(0, 0); // set cursor position.
    lcd.setCursor(0, 0); // set cursor position.
    lcd.write(1); // write to screen the custom graph character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.write(1); // write to screen the custom clear character.
    lcd.setCursor(6, 0); // set cursor position.
    lcd.print("MAX%");// write text next to graph
    break;

    //default: 
    // if nothing else matches, do the default
    // default is optional
  }
}

void loop(){

  display();  // display is called at everyloop and at beginning of it. 
  //So at first time will restore the Display and states from the Level stored at eeprom.

  if (digitalRead(buttonpin1) == LOW){ // min
    int state1= digitalRead(buttonpin1);
    Level=1;
    delay(500);  // debounce
  }
  if (digitalRead(buttonpin2) == LOW) // 25%
  {
    state2 = !state2;  // toggle state
    if (state2 >0 ){ 
      Level = 2;
    }
      if (state2 ==0 ){ 
        Level =1;
    }
      delay(500);  // debounce
    }

 if (digitalRead(buttonpin3) == LOW) //50%
    {
      state3 = !state3;  // toggle state
      if (state3 >0 ){ 
        Level = 3;
      }
      if (state3 ==0 ){ 
        Level = 2;
      }
      delay(500);  // debounce
      }

 if (digitalRead(buttonpin4) == LOW) // 75%
      {
      state4 = !state4;  // toggle state
      if (state4 >0 ){ 
        Level = 4;
      }
      if (state4 ==0 ){ 
        Level = 3;
      }
      delay(500);  // debounce
      }

 if (digitalRead(buttonpin5) == LOW) { // max
      state5 = !state5;  // toggle state
      Level = 5;
      // CUT POWER SUPPLY TO PUMP.
      delay(500);  // debounce
      }

  if (digitalRead(buttonpin5) == HIGH) {  // max reed off
      state5 = !state5;  // toggle state
      if (state5>1) {
        Level = 4; 
      }
      delay(500);  // debounce
      }
    Level=state1+state2+state3+state4+state5;
    EEPROM.write(0, Level); // Write to eeprom memory position 0 the Level value.

     //delay(100); // small delay at each loop.
      }

You ignored what I said here:

You should read some of the recent threads about EEPROM writing. The EEPROM has a life of about 100,000 writes. You will wear it out in a couple of seconds.

Why bother doing this:

 if (digitalRead(buttonpin2) == LOW) // 25%
  {
    state2 = !state2;  // toggle state
    if (state2 >0 ){ 
      Level = 2;
    }
    if (state2 ==0 ){ 
      Level =1;
    }
    delay(500);  // debounce
  }
...
  }
  Level=state1+state2+state3+state4+state5;

You make Level to be 1 or 2, and then just overwrite it with adding the states together.

The states are going to be 0 or 1, right? So why add them?

  Level=state1+state2+state3+state4+state5;

What does that prove? What is the difference between adding 0 + 1 + 0 + 0 + 0 and 1 + 0 + 0 + 0 + 0 ?