Package lejos.hardware.device
Interface DLight
-
public interface DLightInterface for dLights from Dexter Industries- Author:
- Aswin Bouwmeester
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddisable()Disables the dLight.voiddisableBlinking()Disables blinking.voidenable()Enables the dLight.voidenableBlinking()Enables blinking pattern.voidgetColor(int[] rgb)Returns the RGB color of the LED Each of the color values is between 0 (fully off) and 255 (fully on).intgetExternalLED()Gets the PWM value of the external LED driver of the dLight.booleanisBlinkingEnabled()Queries the blinking mode of the dLightbooleanisEnabled()Queries the status of the dLightvoidsetBlinkingPattern(float seconds, int percentageOn)Specifies the blinking pattern of the LED.voidsetColor(int[] rgb)Changes the color of the LED according to specified RGB color.voidsetColor(int red, int green, int blue)Changes the color of the LED according to specified RGB color.voidsetExternalLED(int value)Sets the PWM value of the external LED driver of the dLight.voidsetHSLColor(int hue, int saturation, int luminosity)Changes the color of the LED according to specified HSL color.
-
-
-
Method Detail
-
enable
void enable()
Enables the dLight.
-
disable
void disable()
Disables the dLight. Values for color and blinking pattern are not overwritten and will still be in effect after enabling the dLight again.
-
isEnabled
boolean isEnabled()
Queries the status of the dLight- Returns:
- True, the dLight is enabled. False, the dLight is off.
-
setColor
void setColor(int red, int green, int blue)Changes the color of the LED according to specified RGB color. Each of the color values should be between 0 (fully off) and 255 (fully on).- Parameters:
red-green-blue-
-
setColor
void setColor(int[] rgb)
Changes the color of the LED according to specified RGB color. Each of the color values should be between 0 (fully off) and 255 (fully on).- Parameters:
rgb- Integer array containing RGB colors
-
setHSLColor
void setHSLColor(int hue, int saturation, int luminosity)Changes the color of the LED according to specified HSL color.- Parameters:
hue- The hue value in the range of 0-360saturation- The saturation value in the range of 0-100luminosity- The saturation luminosity value in the range of 0-100
-
setBlinkingPattern
void setBlinkingPattern(float seconds, int percentageOn)Specifies the blinking pattern of the LED. Blinnking mode should be enabled for the pattern to be in effect.- Parameters:
seconds- The total time of a blinking cycle (in seconds)percentageOn- The percentage of the time the LED is on within a blinking cycle
-
enableBlinking
void enableBlinking()
Enables blinking pattern. The blinking pattern should be set with the SetBlinkingPattern method.
-
disableBlinking
void disableBlinking()
Disables blinking. The blinking pattern itself remains in memory.
-
isBlinkingEnabled
boolean isBlinkingEnabled()
Queries the blinking mode of the dLight- Returns:
- True is blinking is enabled. False if blinking is disabled.
-
getColor
void getColor(int[] rgb)
Returns the RGB color of the LED Each of the color values is between 0 (fully off) and 255 (fully on).- Parameters:
rgb-
-
setExternalLED
void setExternalLED(int value)
Sets the PWM value of the external LED driver of the dLight. Each dLight has two leads broken out that can be used to drive an external LED.- Parameters:
value- The values should be between 0 (fully off) and 255 (fully on).
-
getExternalLED
int getExternalLED()
Gets the PWM value of the external LED driver of the dLight. Each dLight has two leads broken out that can be used to drive an external LED.- Returns:
- The return value is between 0 (fully off) and 255 (fully on).
-
-