#include <TinyDebug.h>
#define ButtonPin 1

bool PrevButtonState;
bool ButtonState;

unsigned long LastTimeButtonChanged = millis();
const unsigned long DebounceDuration = 50;
unsigned long LastTimeLedMainChanged = millis();
const unsigned long LedMainDuration = 500;
unsigned long LastTimeLedButtonChanged = millis();
const unsigned long LedButtonDuration = 100;
unsigned long PumpUpStartTime;
const unsigned long PumpUpTimeDuration = 1000;
int counter = 0;
int prev_counter = 0;
int count = 5;

void setup()
{
	pinMode(0, OUTPUT);
	pinMode(1, INPUT);
	digitalWrite(0, HIGH);
	delay(500); // Wait for 500 millisecond(s)
	digitalWrite(0, LOW);
  Debug.begin();
  
}

void loop(){
  if(millis() - LastTimeButtonChanged >= DebounceDuration){
    ButtonState = digitalRead(1);
    	if (ButtonState != PrevButtonState) {
     	 LastTimeButtonChanged = millis();
         PrevButtonState = ButtonState;
          if (ButtonState == LOW){
            counter = prev_counter + 1;
	 	 	      prev_counter = counter;
          }
    	}
  }


Debug.print(F("counter = "));
Debug.println(counter);


  if (counter == count) {
    counter = 0;
    prev_counter = 0;
    digitalWrite(0, HIGH);
    PumpUpStartTime = millis();
  }

  if(millis() - PumpUpStartTime >= PumpUpTimeDuration){
    digitalWrite(0, LOW);
  }

  //if (millis() - LastTimeLedButtonChanged >= LedButtonDuration){

  //}
// delay(25);
if(millis() - LastTimeLedButtonChanged >= LedButtonDuration){
Debug.print(F("counter = "));
Debug.println(counter);
LastTimeLedButtonChanged = millis();
}

}
ATTINY8520PU