Java Class Name: VoltageLED
Notable APIs:
void SetValue( double value );
This sets the LED “brightness” (actually a state image), with a valid range from 0 to 1. If it’s a simple on/off LED skin, it’ll be in the ‘off’ state if the value is less than 0.4 and in the ‘on’ state otherwise. If the LED skin has more than two states, the state to display will be the number of states multiplied by the LED value and then rounded off to an integer, which will be used as a zero-based index into the array of state images. Here’s a screenshot of a module showing the “Red” LED skin, which only has on and off states, and the “Blue and Red” skin, which has off, red, and blue states, with each skin at various values from 0 to 1:
double GetValue();
This returns the LED’s current value.
void SetMomentaryBlink( int milsToBlink );
This turns the LED on for milsToBlink milliseconds, then turns it off again.
void SetBlinkEvery( int blinkIntervalMils, int blinkOnMils );
This makes the LED blink. The blink cycle will be blinkIntervalMils milliseconds long, and the LED will be lit for blinkOnMils milliseconds of the cycle. The button-lit intensity will be whatever the value was in your last call to SetValue()
, so call SetValue()
just before calling SetBlinkEvery()
to make sure it lights up during the blink-on part of the cycle.
void StopBlinking();
Stops the LED from blinking.
Save/Restore State: Voltage Modular doesn’t save state for LEDs.