Firmware  0.4.1
Loading...
Searching...
No Matches
LED

Table of Contents

This module handles dimming the LEDs. The brightness (duty cycle) can be configured for each LED.

Initialization

Initialization takes place in init(). This function configures a 4kHz LEDC timer with 2 channels for the bug and WiFi LEDs. The resolution of the PWM is 8 bits.

Bug LED

The blue "bug LED" serves as an indicator for any kind of programming mode (e.g. firmware update, DCC service mode, ...) as well as an error indicator. The function bug() can be used to switch the LED on or off with its set duty cycle. The duty cycle can be read via mem::nvs::Settings::getLedDutyCycleBug(). Since this LED is often used as an update indicator, in addition to the free function there is also the RAII wrapper Bug that can switch the LED on in its constructor and off in its destructor.

WiFi LED

The green "WiFi LED" indicates the network connection status. It lights up when a connection is established and turns off when the connection is lost. The function wifi() can be used to switch the LED on or off with its set duty cycle. The duty cycle can be read via mem::nvs::Settings::getLedDutyCycleWiFi().

Previous Next
Analog Out