Class BO.io.RGBLED
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.
Defined in: RGBLED.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.io.RGBLED(board, redLEDPin, greenLEDPin, blueLEDPin, driveMode)
The RGB pins of the RGBLED must be connected to PWM pins on the IOBoard.
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> <constant> |
BO.io.RGBLED.COMMON_ANODE
|
| <static> <constant> |
BO.io.RGBLED.COMMON_CATHODE
|
| Method Attributes | Method Name and Description |
|---|---|
|
fadeIn(time)
Fade in the RGBLED from the off state
|
|
|
fadeOut(time)
Fade out the RGBLED from the on state
|
|
|
fadeTo(red, green, blue, time)
Fade from the current color to the new color
|
|
|
setColor(red, green, blue)
Set the RGBLED color
|
Class Detail
BO.io.RGBLED(board, redLEDPin, greenLEDPin, blueLEDPin, driveMode)
The RGB pins of the RGBLED 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 RGBLED, 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.
- Parameters:
- {IOBoard} board
- A reference to the IOBoard instance that the servo is attached to.
- {Pin} redLEDPin
- A reference to the IOBoard Pin the red led pin is connected to.
- {Pin} greenLEDPin
- A reference to the IOBoard Pin the green led pin is connected to.
- {Pin} blueLEDPin
- A reference to the IOBoard Pin the blue led pin is connected to.
- {Number} driveMode
- The drive mode of the RGBLED. Must be set to RGBLED.COMMON_ANODE or RGBLED.COMMON_CATHODE. RGBLED.COMMON_ANODE is default.
Field Detail
<static> <constant>
BO.io.RGBLED.COMMON_ANODE
<static> <constant>
BO.io.RGBLED.COMMON_CATHODE
Method Detail
fadeIn(time)
Fade in the RGBLED from the off state
- Parameters:
- {Number} time
- The time of the fade (in milliseconds)
fadeOut(time)
Fade out the RGBLED from the on state
- Parameters:
- {Number} time
- The time of the fade (in milliseconds)
fadeTo(red, green, blue, time)
Fade from the current color to the new color
- Parameters:
- {Number} red
- The red value to fade to (0 - 255)
- {Number} green
- The green value to fade to (0 - 255)
- {Number} blue
- The blue value to fade to (0 - 255)
- {Number} time
- The time of the fade (in milliseconds)
setColor(red, green, blue)
Set the RGBLED color
- Parameters:
- {Number} red
- The red value (0 - 255)
- {Number} green
- The green value (0 - 255)
- {Number} blue
- The blue value (0 - 255)
