// Para usar la versión 2.x.x en diagram.json
// "attrs": {"builder": "esp32-core-2.0.3"}
//#include <M5Core2.h>
#define LED_PIN 14
hw_timer_t *timerLed = NULL;
void IRAM_ATTR changeState()
{
//Invert current state of the LED
digitalWrite(LED_PIN, !(digitalRead(LED_PIN)));
}
void setup() {
//M5.begin();
//Select LED_PIN mode
pinMode(LED_PIN, OUTPUT);
timerLed = timerBegin(0, 80, true); // use tiemr 0 and set prescale to 80 so 1 tick is 1 uSec
timerAttachInterrupt(timerLed, &changeState, true); // point to the ISR
timerAlarmWrite(timerLed, 1000000, true); // set alarm every 1 sec
timerAlarmEnable(timerLed); // enable the alarm
}
void loop() {
}