Show:

BO.io.RGBLED Class

Defined in: src/io/RGBLED.js:22

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
)

Defined in src/io/RGBLED.js:22

Parameters:

  • board IOBoard

    A reference to the IOBoard instance that the servo is attached to.

  • redLEDPin Pin

    A reference to the IOBoard Pin the red LED pin is connected to.

  • greenLEDPin Pin

    A reference to the IOBoard Pin the green LED pin is connected to.

  • blueLEDPin Pin

    A reference to the IOBoard Pin the blue LED pin is connected to.

  • driveMode Number

    The drive mode of the RGBLED. Must be set to RGBLED.COMMONANODE or RGBLED.COMMONCATHODE. RGBLED.COMMON_ANODE is default.

Item Index

Properties

Methods

fadeIn

(
  • time
)

Defined in src/io/RGBLED.js:90

Fade in the RGBLED from the off state.

Parameters:

  • time Number

    The time of the fade (in milliseconds)

fadeOut

(
  • time
)

Fade out the RGBLED from the on state.

Parameters:

  • time Number

    The time of the fade (in milliseconds)

fadeTo

(
  • red
  • green
  • blue
  • time
)

Fade from the current color to the new color.

Parameters:

  • red Number

    The red value to fade to (0 - 255)

  • green Number

    The green value to fade to (0 - 255)

  • blue Number

    The blue value to fade to (0 - 255)

  • time Number

    The time of the fade (in milliseconds)

setColor

(
  • red
  • green
  • blue
)

Defined in src/io/RGBLED.js:72

Set the RGBLED color.

Parameters:

  • red Number

    The red value (0 - 255)

  • green Number

    The green value (0 - 255)

  • blue Number

    The blue value (0 - 255)

Properties

RGBLED.COMMON_ANODE

Unknown static

RGBLED.COMMON_CATHODE

Unknown static