CTRL library / LEDs
LED methods
There are two ways to instantiate an LED:
CtrlLed(sig, maxBrightness): Creates an LED in PWM mode for brightness control on a PWM-capable pin.CtrlLed(sig): Creates an LED in digital mode for simple on/off control on any pin.
Core
turnOn(): Turns on the LED.turnOff(): Turns off the LED.toggle(): Toggles the LED's off/on status.set(true): Turns the LED on (true) or off (false), e.g.led.set(button.isPressed());
Brightness (PWM mode)
setMaxBrightness(255): Sets the maximum brightness of the LED, for calibration purposes (0 - 255). PWM mode only.setBrightness(100): Sets the brightness of the LED in percentages (0 - 100). PWM mode only.getMaxBrightness(): Returns the maximum brightness set for the LED.getBrightness(): Returns the brightness of the LED.
State
isOn(): Checks if the LED is turned on.isOff(): Checks if the LED is turned off.isPwmMode(): Checks if the LED is in PWM mode. Returns true if the LED is on a PWM-capable pin, false if in digital mode.isEnabled(): Checks if the LED is enabled.isDisabled(): Checks if the LED is disabled.enable(): Enables the LED.disable(): Disables the LED.