Package ej.microui.led
Class Leds
- java.lang.Object
-
- ej.microui.led.Leds
-
public class Leds extends Object
This class is used to manage all LEDs available on the platform. The available number of LEDs is known thanks to the methodgetNumberOfLeds(). A LED is identified by to its identifier. The range of the identifiers is from0togetNumberOfLeds()-1.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_INTENSITYConstant for turning on a LED.
If a LED does not handle intensity, any valid intensity different fromMIN_INTENSITYturns the LED on.static intMIN_INTENSITYConstant for turning off a LED.
-
Constructor Summary
Constructors Constructor Description Leds()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetLedIntensity(int ledId)Gets the intensity of the specified LED.static intgetNumberOfLeds()Returns the available number of LEDs.static voidsetLedIntensity(int ledId, int intensity)Controls the intensity of the specified LED.static voidsetLedOff(int ledId)Turns off the given LED.static voidsetLedOn(int ledId)Turns on the given LED.
-
-
-
Field Detail
-
MIN_INTENSITY
public static final int MIN_INTENSITY
Constant for turning off a LED.- See Also:
- Constant Field Values
-
MAX_INTENSITY
public static final int MAX_INTENSITY
Constant for turning on a LED.
If a LED does not handle intensity, any valid intensity different fromMIN_INTENSITYturns the LED on.- See Also:
- Constant Field Values
-
-
Method Detail
-
getNumberOfLeds
public static int getNumberOfLeds()
Returns the available number of LEDs. The range of valid led identifiers is [0..Leds.getNumberOfLeds()-1].- Returns:
- the number of leds
-
setLedIntensity
public static void setLedIntensity(int ledId, int intensity)Controls the intensity of the specified LED. If the identifier is invalid (out of range) the method has no effect.- Parameters:
ledId- the led identifierintensity- the intensity to set on the led
-
getLedIntensity
public static int getLedIntensity(int ledId)
Gets the intensity of the specified LED. If the identifier is invalid (out of range) the method returns 0.- Parameters:
ledId- the led identifier- Returns:
- the led intensity
-
setLedOn
public static void setLedOn(int ledId)
Turns on the given LED. The effect is identical toLeds.setLedIntensity(ledId, MAX_INTENSITY).- Parameters:
ledId- the led identifier
-
setLedOff
public static void setLedOff(int ledId)
Turns off the given LED. The effect is identical toLeds.setLedIntensity(ledId, MIN_INTENSITY).- Parameters:
ledId- the led identifier
-
-