#define Pump 0
#define ButPin 1
#define ResetPin 2

int counter = 0;
int PumpUpTime = 250; //dafault value: 200 ms pulse time for pump

unsigned long CurrentTime;
unsigned long LoopEndTime;

bool but_state = 0;
bool past_but_state = 1;
bool reset_state = 0;
bool past_reset_state = 1;

void setup() {
  pinMode(ButPin, INPUT_PULLUP);
  pinMode(ResetPin, INPUT_PULLUP);
  pinMode(Pump, OUTPUT);
  //Serial.begin(9600);
}

void loop() {
  past_but_state = but_state;
  but_state = digitalRead(ButPin);

if (but_state != past_but_state && digitalRead(ButPin) == LOW) {
      counter ++;
    }

if (counter == 5) {
  digitalWrite(Pump, HIGH);
  delay(PumpUpTime);
  digitalWrite(Pump, LOW);
  counter = 0;
}

  past_reset_state = reset_state;
  reset_state = digitalRead(ResetPin);

if (reset_state != past_reset_state && digitalRead(ResetPin) == LOW) {
    counter = 0;
  }

  delay(40);
}
ATTINY8520PU