Class 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 method getNumberOfLeds(). A LED is identified by to its identifier. The range of the identifiers is from 0 to getNumberOfLeds()-1.
    • 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 from MIN_INTENSITY turns the LED on.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Leds

        public Leds()
    • 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 identifier
        intensity - 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 to Leds.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 to Leds.setLedIntensity(ledId, MIN_INTENSITY).
        Parameters:
        ledId - the led identifier