#define LED_PIN 14 // GPIO pin where the LED is connected on the M5Core2
hw_timer_t*timer=NULL;
int cont=0;
void IRAM_ATTR changeState() {
digitalWrite(LED_PIN, !(digitalRead(LED_PIN)));
cont++;
if(cont==20) timerStop(timer);
}
void setup() {
//M5.begin(); // Initialize the M5Core2 hardware (display, I2C, etc.)
pinMode(LED_PIN, OUTPUT); // Configure the LED pin as an output
timer = timerBegin(80000);
timerAttachInterrupt(timer, &changeState);
timerWrite (timer, 500000);
timerAlarm(timer, 80000, true, 0);
}
void loop() {
}