Show:
Extends webduino.Module

The RGBLed Class.

Constructor

webduino.module.RGBLed
(
  • board
  • redLedPin
  • greenLedPin
  • blueLedPin
  • driveMode
)

Parameters:

  • board webduino.Board

    The board the RGB LED is attached to.

  • redLedPin webduino.Pin

    The pin the red LED is connected to.

  • greenLedPin webduino.Pin

    The pin the green LED is connected to.

  • blueLedPin webduino.Pin

    The pin the blue LED is connected to.

  • [driveMode] Number optional

    Drive mode the RGB LED is operating at, either RGBLed.COMMON_ANODE or RGBLed.COMMON_CATHODE.

Methods

addListener
(
  • type
  • listener
)

Add a listener for a certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

emit
(
  • type
  • object,...
)

Emit an event of certain type.

Parameters:

  • type String

    Event type.

  • [object,...] Object optional

    Event object(s).

listeners
(
  • type
)

Return the listener list bound to certain type of event.

Parameters:

  • type String

    Evnet type.

on
(
  • type
  • listener
)

Alias for EventEmitter.addListener(type, listener)

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

once
(
  • type
  • listener
)

Add a one-time listener for a certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

removeAllListeners
(
  • type
)

Remove all listeners of certain type.

Parameters:

  • type String

    Event type.

removeListener
(
  • type
  • listener
)

Remove a listener for certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

setColor
(
  • red
  • green
  • blue
  • callback
)

Light up and mix colors with the LEDs.

Parameters:

  • red Number

    The brightness of the red LED.

  • green Number

    The brightness of the green LED.

  • blue Number

    The brightness of the blue LED.

  • [callback] Function optional

    Function to call when the color is set.

setMaxListeners
(
  • n
)

Set maximum number of listeners that is allow to bind on an emitter.

Parameters:

  • n Number

    Number of listeners.

Properties

COMMON_ANODE

Number const static

Indicates the common anode drive mode.

COMMON_CATHODE

Number const static

Indicates the common cathode drive mode.

Attributes

type

String readonly

Type of the module.