//https://deepbluembedded.com/esp32-timers-timer-interrupt-tutorial-arduino-ide/
//https://docs.espressif.com/projects/arduino-esp32/en/latest/api/timer.html
#define LED 4
hw_timer_t *Timer0_Cfg = NULL;
void IRAM_ATTR Timer0_ISR()
{
digitalWrite(LED, !digitalRead(LED));
}
void setup()
{
Serial.begin(115200);
pinMode(LED, OUTPUT);
Timer0_Cfg = timerBegin(1000000);
timerAttachInterrupt(Timer0_Cfg, &Timer0_ISR);
timerAlarm(Timer0_Cfg, 500000, true, 0);
}
void loop()
{
// Do Nothing!
}