hw_timer_t *My_timer = NULL;
hw_timer_t *My_timer1 = NULL;
int count = 0;
void IRAM_ATTR onTimer() {
digitalWrite(2, !digitalRead(2));
}
void IRAM_ATTR onTimer1() {
if ((count == 0 ) || (count == 1) ||(count == 4 ) || (count == 5)||(count == 8 ) || (count == 9)||(count == 14 )||(count == 16 )||(count == 18 )||(count == 20 )||(count == 22 )||(count == 24 )) {
digitalWrite(25, HIGH);
}
else if ((count == 2 ) || (count == 3)||(count == 6 )|| (count == 7)||(count == 10 )|| (count == 11)||(count == 12 ) || (count == 13)||(count == 15 )||(count == 17 )||(count == 19 )||(count == 21 )||(count == 23 )||(count == 25 )||(count == 26 )||(count == 27 )||(count == 28 )) {
digitalWrite(25, LOW);
}
count++;
if(count>=29){
count = 0 ;
}
}
void setup() {
pinMode(2, OUTPUT);
pinMode(25, OUTPUT);
My_timer = timerBegin(0, 80, true);
timerAttachInterrupt(My_timer, &onTimer, true);
timerAlarmWrite(My_timer, 1000000, true);
timerAlarmEnable(My_timer);
My_timer1 = timerBegin(1, 40, true);
timerAttachInterrupt(My_timer1, &onTimer1, true);
timerAlarmWrite(My_timer1, 1000000, true);
timerAlarmEnable(My_timer1);
}
void loop() {
}