Class RGBLEDHelper
java.lang.Object
com.opensourcewithslu.outputdevices.RGBLEDHelper
The RBGLEDHelper class handles all interactions with a RGB LED.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidledOff()Turns off the RGB LED.voidledOn()Turns on the RGB LED with default RGB values of 100,100,100 and frequencies of 200 Hertz.voidsetBlue(int blue) Sets the blue value of the LED.voidsetBlue(int blue, int frequency) Sets the blue value and frequency of the LED.voidsetColor(int[] colors) Sets the color of the LED based of inputted RGB values.voidsetColor(int[] colors, int[] frequency) Sets the color of the LED using the array of RGB values and an array of frequencies.voidsetColorHex(String hex) Setting the color of the LED using a hexadecimal value.voidsetColorHex(String hex, int[] frequency) Setting the color of the LED using a hexadecimal value and an array of frequencies.voidsetGreen(int green) Sets the green value of the LED.voidsetGreen(int green, int frequency) Sets the green value and frequency of the LED.voidsetRed(int red) Sets the red value of the LED.voidsetRed(int red, int frequency) Sets the red value and frequency of the LED.
-
Constructor Details
-
RGBLEDHelper
The RGBLEDHelper constructor.- Parameters:
pwm- AMultiPinConfigurationObject.
-
-
Method Details
-
setColor
public void setColor(int[] colors) Sets the color of the LED based of inputted RGB values. Set with a default frequency of 200 Hertz.- Parameters:
colors- RGB values in an array. [Red,Green,Blue].
-
setColor
public void setColor(int[] colors, int[] frequency) Sets the color of the LED using the array of RGB values and an array of frequencies.- Parameters:
colors- RGB values in an array. [Red,Green,Blue].frequency- Frequency values(in Hertz) for the corresponding RGB value. [Red frequency, Green frequency, Blue frequency]
-
setColorHex
Setting the color of the LED using a hexadecimal value. Default frequency of 200 Hertz is used.- Parameters:
hex- Hexadecimal number optionally prefixed by 0x.
-
setColorHex
Setting the color of the LED using a hexadecimal value and an array of frequencies.- Parameters:
hex- Hexadecimal number optionally prefixed by 0x.frequency- Frequency values(in Hertz) for the corresponding RGB value. [Red frequency, Green frequency, Blue frequency]
-
setRed
public void setRed(int red) Sets the red value of the LED. Default 200 Hertz frequency used.- Parameters:
red- Integer value representing the red in the RGB value of the LED.
-
setRed
public void setRed(int red, int frequency) Sets the red value and frequency of the LED.- Parameters:
red- Integer value representing the red in the RGB value of the LED.frequency- Frequency of the red value in Hertz.
-
setBlue
public void setBlue(int blue) Sets the blue value of the LED. Default 200 Hertz frequency used.- Parameters:
blue- Integer value representing the blue in the RGB value of the LED.
-
setBlue
public void setBlue(int blue, int frequency) Sets the blue value and frequency of the LED.- Parameters:
blue- Integer value representing the blue in the RGB value of the LED.frequency- Frequency of the blue value in Hertz.
-
setGreen
public void setGreen(int green) Sets the green value of the LED. Default 200 Hertz frequency used.- Parameters:
green- Integer value representing the green in the RGB value of the LED.
-
setGreen
public void setGreen(int green, int frequency) Sets the green value and frequency of the LED.- Parameters:
green- Integer value representing the green in the RGB value of the LED.frequency- Frequency of the green value in Hertz.
-
ledOff
public void ledOff()Turns off the RGB LED. -
ledOn
public void ledOn()Turns on the RGB LED with default RGB values of 100,100,100 and frequencies of 200 Hertz.
-