//ATtiny85 Leading edges test

#include<avr/io.h>
#include<util/delay.h>
#include <avr/interrupt.h>
#define F_CPU 8000000UL
#define BLED_PIN PB1;
#define INTERRUPT_PIN PB2;

void counter_setup()
{
  DDRB = (1 << PB0) | (1 << PB1);
  TCCR0A = 0X00; //TCCR0A to low for normal port operation and mode 0.
  TCCR0B = 0X00; //WGM02=0
  TCCR0B =  bit (CS00);  //  no prescaling

 TCNT0 = 0x00; //initializing the counter to 0
  GIMSK = bit (INT0); //enabling external interrupt INT0
  MCUCR = bit (ISC01); // | bit(ISC00); // falling edge sense
  sei(); //enabling global interrupt

}



ISR(INT0_vect) // External interruption code
{
 unsigned int count = TCNT0;

    if (count >= 5)
    {
           _delay_ms(200);
            PORTB = 0b00000010;
    }
else
  // while (1)
  {
    PORTB = 0b00000001;
  _delay_ms(200);
    PORTB = 0b00000000;
  _delay_ms(200);
  }

}

int main()
{
  counter_setup();
  while(1)
  {
    //  PORTB = 0b00000001;
  }
}
ATTINY8520PU