// Robotronix.co.il
#define LED 32
hw_timer_t *My_timer = NULL;
void IRAM_ATTR onTimer(){
digitalWrite(LED, !digitalRead(LED));
}
void setup() {
pinMode(LED, OUTPUT);
My_timer = timerBegin(0, 80, true); // TIMEER 0-3,PRESCALR, COUNER UP ?
timerAttachInterrupt(My_timer, &onTimer, true);
/* timerAttachInterrupt:
pecify the counter value in which the timer interrupt should be
generated. So, for this example, we assume that we
want to generate an interrupt each second, and thus we
pass the value of 1000000 microseconds, which is equal to 1 second.
For the third argument, we will pass the value true, so the counter
will reload and thus the interrupt will be generated periodically.
*/
timerAlarmWrite(My_timer, 1000000, true);
// enabling the timer interrupt using the function timerAlarmEnable.
timerAlarmEnable(My_timer);
}
void loop() {
}