Class RGBLEDHelper
java.lang.Object
com.opensourcewithslu.outputdevices.RGBLEDHelper
The RBGLEDHelper class handles all interactions with a RGB LED.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
ledOff()
Turns off the RGB LED.void
ledOn()
Turns on the RGB LED with default RGB values of 100,100,100 and frequencies of 200 Hertz.void
setBlue
(int blue) Sets the blue value of the LED.void
setBlue
(int blue, int frequency) Sets the blue value and frequency of the LED.void
setColor
(int[] colors) Sets the color of the LED based of inputted RGB values.void
setColor
(int[] colors, int[] frequency) Sets the color of the LED using the array of RGB values and an array of frequencies.void
setColorHex
(String hex) Setting the color of the LED using a hexadecimal value.void
setColorHex
(String hex, int[] frequency) Setting the color of the LED using a hexadecimal value and an array of frequencies.void
setGreen
(int green) Sets the green value of the LED.void
setGreen
(int green, int frequency) Sets the green value and frequency of the LED.void
setRed
(int red) Sets the red value of the LED.void
setRed
(int red, int frequency) Sets the red value and frequency of the LED.
-
Constructor Details
-
RGBLEDHelper
The RGBLEDHelper constructor.- Parameters:
pwm
- AMultiPinConfiguration
Object.
-
-
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.
-