#include <avr/interrupt.h>
int count1=0;
ISR(TIMER1_COMPA_vect)
{
TCNT1=0;
count1++;
Serial.println(count1);
}
ISR(TIMER1_OVF_vect)
{
digitalWrite(4, HIGH);
OCR1A+=62.5;
digitalWrite(4,LOW);
}
void setup() {
pinMode(4, OUTPUT);
pinMode(13, OUTPUT);
// put your setup code here, to run once:
TCCR1B=0;
TCCR1A=0;
TCCR1B|=B00000100;
// OCR1A=62.5;
TIMSK1|=B00000011;
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
task1();
}
void task1()
{
if(count1==10)
{
//TIMSK1|=B00000001;
}
digitalWrite(13, HIGH);
OCR1A+=62.5;
digitalWrite(13,LOW);
OCR1A+=62.5;
}