i modified the program.instead of overflow mode i made it ctc mode. but it just light all trough out the time.
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#define SECONDS .1
#define F_CPU 8000000UL
#define PRESCALER 256
#define LONG_PUSH 3 // # seconds for a long button push
#define DEBOUNCE 0.25 // # ms for a valid button push
// Button status ===================================
#define NOPRESS 0
#define PRESSED 1
#define SHORT 2
#define LONG 3
#define HANDLED 4
#define CHECK_LONG // whether we check for long pushes or not
unsigned int button_flag = NOPRESS; // current button status
unsigned int button_timer; // for debouncing button
//Main Method
int main(void)
{
DDRB &= ~(1 << PINB3); //Data Direction Register input PINB3
PORTB |= 1 << PINB3; //Set PINB1 to a high reading
DDRB |= (1 << PINB0); //Set Direction for output on PINB0
PORTB ^= 1 << PINB0; //Toggling only Pin 0 on port b
TCCR1B |= (1 << WGM12); // Configure timer 1 for CTC mode
TIMSK1 |= (1 << OCIE1A); // Enable CTC interrupt
sei(); // Enable global interrupts
OCR1A = (((F_CPU/PRESCALER)*SECONDS)-1); // Set CTC compare value to 100ms at 8MHz AVR clock, with a prescaler of 256
TCCR1B |= (1 << CS12); // Start timer at Fcpu/256
for (;

{
}
}
ISR(TIMER1_COMPA_vect)
{
if (!(PINB & (1<<PINB3)))
{
if (button_flag == NOPRESS)
{
button_timer = 0; // start the debounce timer
button_flag = NOPRESS; // it is not down
}
#ifdef CHECK_LONG
if (button_flag = PRESSED)
if (button_flag == PRESSED) { // button is down - have we already noted that ?
button_timer++; // inc the debounce timer
if (button_timer == LONG_PUSH) { // long enough for a LONG push ?
button_flag = LONG; // yup - note a LONG push
}
}
#endif
} else {
if (button_flag == PRESSED) { // button is up, was it pushed before ?
if (button_timer == DEBOUNCE) { // was it long enough for a short push ?
button_flag = SHORT; // past bounce timeout, was a short push
} else button_flag = NOPRESS; // nope, too short - was a bounce
}
if (button_flag == HANDLED) { // button is up
button_flag = NOPRESS; // reset back to waiting for push
}
else
{button_flag = NOPRESS;} // otherwise, wait till we handle it
}
}