Update working code
int var;
void setup() {
// put your setup code here, to run once:
SREG = SREG | (1<<7); // Gloval interrupt enable
TCCR0A =(1<<WGM01); // Clear counter on compare match mode
OCR0A = 255; // when TCNT equal OCR0 interrupt will generate
TIMSK0 = (1<<OCIE0A); // Output Compare Match A Interrupt Enable
TCCR0B = (1<<CS00) | (1<<CS02); // Prescaling by 1024
DDRB = DDRB | (1<<5);
Serial.begin(9600); // Initialize the USART
Serial.println("Start"); // Write the welcome message
}
void loop() {
// put your main code here, to run repeatedly:
}
ISR(TIMER0_COMPA_vect){
var++;
// Serial.print(var);
volatile long unsigned i;
if(var == 246){
PORTB = PORTB | (1<<5);
for(i=0; i<300000; i++);
PORTB = PORTB & ~(1<<5);
var=0;
}
}