// Copyright (c) 2023 Oleg Kalachev // Repository: https://github.com/okalachev/flix // Board's LED control #define BLINK_PERIOD 500000 #ifndef LED_BUILTIN #define LED_BUILTIN 2 // for ESP32 Dev Module #endif void setupLED() { pinMode(LED_BUILTIN, OUTPUT); } void setLED(bool on) { static bool state = false; if (on == state) { return; // don't call digitalWrite if the state is the same } digitalWrite(LED_BUILTIN, on ? HIGH : LOW); state = on; } void blinkLED() { setLED(micros() / BLINK_PERIOD % 2); }