LED

Agent.Peripherals. LED

Control the MeldCX LED Controller Peripheral Device
Note: Only available in AgentM Emualtor as of 2/9/19

Note: This driver implements the Standard Driver Interface.

Methods

(async) getColorFormat() → {Promise.<module:LED~LEDColorFormat>}

Returns the color encoding.

Throws:

(async) getInfo() → {Promise.<module:LED~LEDControllerInfo>}

Return information about the LED Controller

Throws:

(async) getLEDCount(channel) → {Promise.<Number>}

Get the number of LEDs in the strips

Parameters:
Name Type Description
channel Number

The channel of the LED Strip

Throws:

(async) getType() → {Promise.<module:LED~LEDStripType>}

Get the LED Strip Type

Throws:

(async) MakeColor(red, green, blue, white) → {Promise.<module:LEDController~Color>}

Make a color from RGBW

Parameters:
Name Type Description
red Number

The amount of red from 0 to 255;

green Number

The amount of green from 0 to 255;

blue Number

The amount of blue from 0 to 255;

white Number

The amount of white from 0 to 255;

Throws:

(async) MakeColorFromHex(color) → {Promise.<module:LED~Color>}

Make a color from HEX

Parameters:
Name Type Description
color Number | String

The color as a hex value i.e. '#ccff00;' or 0xCCFF00

Throws:

onLEDControllerConnected(cb)

Register a callback for an event of type onLEDControllerConnected

Parameters:
Name Type Description
cb function

The callback to register

onLEDControllerDisconnected(cb)

Register a callback for an event of type onLEDControllerDisconnected

Parameters:
Name Type Description
cb function

The callback to register

(async) reboot() → {Promise.<undefined>}

Reboot the LED Controller.

Throws:

(async) resetSettings() → {Promise.<undefined>}

Reset the settings. Defaults the colors of leds and the flash rate.

Throws:

(async) setColorFormat(format) → {Promise.<undefined>}

Set the color encoding of the LED Strip

Parameters:
Name Type Description
format LEDColorFormat

The format of the LED color encoding

Throws:

(async) setFlashRate(channel, rate) → {Promise.<undefined>}

Set the rate at which the LEDS on a specific channel/strip will flash.

Parameters:
Name Type Description
channel Number

The channel of the LED Strip

rate Number

The rate for the LEDs to flash at from 1 - 127 where each step represents a 50ms delay.

Throws:

(async) setLEDCount(count) → {Promise.<undefined>}

Set the number of LEDs in the strips

Parameters:
Name Type Description
count Number

The number of LEDs in the strips

(async) setType(type) → {Promise.<undefined>}

Set the LED Strip type to allow the LED controller to send the correct signal to the strip.

Parameters:
Name Type Description
type LEDStripType

The type of the LED Strip

Throws:

(async) toggleAllOff(channel, optsopt) → {Promise.<undefined>}

Toggle all of the LEDS on the channel/strip to turn off.

Parameters:
Name Type Attributes Default Description
channel Number

The channel of the LED Strip

opts Option <optional>
DEFAULT_OPTS

The optional params for this function.

(async) toggleAllOn(channel, color, optsopt) → {Promise.<undefined>}

Toggle all of the LEDs on the channel/strip to turn on to a specific color.

Parameters:
Name Type Attributes Default Description
channel Number

The channel of the LED Strip

color Color

The color to set the LED Strip to

opts Option <optional>
DEFAULT_OPTS

The optional params for this function.

(async) toggleFlashOff(channel) → {Promise.<undefined>}

Toggle all of the LEDS on a specific channel to not flash

Parameters:
Name Type Description
channel Number

The channel of the LED Strip

Throws:

(async) toggleFlashOn(channel) → {Promise.<undefined>}

Toggle all of the LEDS on a specific channel to Flash

Parameters:
Name Type Description
channel Number

The channel of the LED Strip

Throws:

(async) toggleOneOff(channel, address, optsopt) → {Promise.<undefined>}

Toggle on LED to turn off.

Parameters:
Name Type Attributes Default Description
channel Number

The channel of the LED Strip

address Number

The address of the individual LED

opts Option <optional>
DEFAULT_OPTS

The optional params for this function.opts

Throws:

(async) toggleOneOn(channel, address, color, optsopt) → {Promise.<undefined>}

Toggle one LED to turn on to a specific color

Parameters:
Name Type Attributes Default Description
channel Number

The channel of the LED Strip

address Number

The address of the indvidiual LED

color Color

The color to set the LED to

opts Option <optional>
DEFAULT_OPTS

The optional params for this function.

Throws: