BO.io.RGBLED Class
Creates an interface to an RGB LED. This interface is for the type of RGB LED with 4 legs. One leg is connected to power or ground (depending on the type of LED - common anode or common cathode) and the other 3 legs are connected to PWM pins on the I/O board. See Breakout/examples/schematics.pdf for wiring diagrams. See Breakout/examples/actuators/rgb_led.html for an example application.
The RGB pins of the RGB LED must be connected to PWM pins on the IOBoard.
COMMON_ANODE
vs COMMON_CATHODE
. You can determine if your RGB LED is
common anode or common cathode by reading the datasheet. To wire a
common cathode RGB LED, connect the cathode to ground and the 3 anode
pins to the IOBoard PWM pins via 330 ohm resistors. For a common anode
LED, the anode is connected to power and the 3 cathode pins are connected
to the IOBoard PWM pins via 330 ohm resistors.
Constructor
BO.io.RGBLED
-
board
-
redLEDPin
-
greenLEDPin
-
blueLEDPin
-
driveMode
Parameters:
-
board
IOBoardA reference to the IOBoard instance that the servo is attached to.
-
redLEDPin
PinA reference to the IOBoard Pin the red LED pin is connected to.
-
greenLEDPin
PinA reference to the IOBoard Pin the green LED pin is connected to.
-
blueLEDPin
PinA reference to the IOBoard Pin the blue LED pin is connected to.
-
driveMode
NumberThe drive mode of the RGBLED. Must be set to RGBLED.COMMON_ANODE or RGBLED.COMMON_CATHODE. RGBLED.COMMON_ANODE is default.
Item Index
Properties
- RGBLED.COMMON_ANODE static
- RGBLED.COMMON_CATHODE static
Methods
fadeIn
-
time
Fade in the RGBLED from the off state.
Parameters:
-
time
NumberThe time of the fade (in milliseconds)
fadeOut
-
time
Fade out the RGBLED from the on state.
Parameters:
-
time
NumberThe time of the fade (in milliseconds)
fadeTo
-
red
-
green
-
blue
-
time
Fade from the current color to the new color.
Parameters:
-
red
NumberThe red value to fade to (0 - 255)
-
green
NumberThe green value to fade to (0 - 255)
-
blue
NumberThe blue value to fade to (0 - 255)
-
time
NumberThe time of the fade (in milliseconds)
setColor
-
red
-
green
-
blue
Set the RGBLED color.
Parameters:
-
red
NumberThe red value (0 - 255)
-
green
NumberThe green value (0 - 255)
-
blue
NumberThe blue value (0 - 255)