Class: Stacklight

Stacklight

Provides methods and properties for accessing a stacklight.

Members


color :number

Gets/Sets the colors/buzzer of the Stacklight.

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
See:

Color :object

Available colors for a Stacklight. Stacklight colors can be combined (OR'd) to perform operations on more than one color at once.

Type:
  • object
Properties:
Name Type Description
None number

0

Green number

1

Yellow number

2

Red number

4

Blue number

8

White number

16

Buzz number

32

Since:
  • 1.0 (WAT 1.0)
See:

flash :number

Similar to color, but toggles the color according to onTime and offTime. The colors selected in flash will toggle after onTime ms, then again after offTime ms.

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
See:
Example
sl.color = sl.Color.White;

<readonly> isOn :number

Returns all of the colors that are either on or flashing

Type:
  • number
Since:
  • 1.3 (WAT 1.4)
See:

offTime :number

The number of milliseconds for the 'off' portion of the flash

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
See:

onTime :number

The number of milliseconds for the 'on' portion of the flash

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
See:

Methods


off(color)

Turn off color(s). Unspecified color will not be changed.

Parameters:
Name Type Description
color number

The color(s) to turn off. Combination of colors.

Since:
  • 1.0 (WAT 1.0)
See:
Example
sl.off(sl.Color.Buzz | sl.Color.Green | sl.Color.White);

on(color)

Turn on color(s). Unspecified color will not be changed.

Parameters:
Name Type Description
color number

The color(s) to turn on. Combination of colors.

Since:
  • 1.0 (WAT 1.0)
See:
Example
sl.on(sl.Color.Red | sl.Color.Green);

pulse(milliseconds)

Pulse the buzzer. The buzzer will turn on for the specified number of milliseconds.

Parameters:
Name Type Description
milliseconds number

The number of milliseconds to turn the buzzer on for.

Since:
  • 1.0 (WAT 1.0)

toggle(color)

Toggle color(s). Unspecified color will not be changed.

Parameters:
Name Type Description
color number

The color(s) to toggle. Combination of colors.

Since:
  • 1.0 (WAT 1.0)
See:
Example
sl.toggle(sl.Color.Yellow);

Events


stateChanged

Indicates that the state of the stacklight has changed. Event will only fire if monitor mode has been enabled.

Type: object
Parameters:
Name Type Description
state object
Properties:
Name Type Description
color number

Current color setting

flash number

Current flash setting

solid number

Colors that are set, but not flashing

on number

Colors that are set or flashing

off number

Colors that are neither set nor flashing

onTime number

On time for flashing

offTime number

Off time for flashing

Since:
  • 1.0 (WAT 1.0)
See:
Example
sl.stateChanged.connect(function(state) {
   console.log('Stacklight changed to ' + state.color);
});