Files
flix/flix/led.ino
Oleg Kalachev e8341976f6 Cleanup
2025-03-01 00:02:44 +03:00

24 lines
483 B
C++

// Copyright (c) 2023 Oleg Kalachev <okalachev@gmail.com>
// 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;
}