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