Class: Outputs

Outputs

Provides methods and properties for accessing all digital outputs.

Members


flash :number

Gets/sets flashing state of the outputs as a bitmask. Bit 1 for output 1, bit 2 for output 2, etc. When flashing, outputs follow the times set in onTime and offTime. If an output is also set (state = true) while it is flashing, then it will follow the opposite times (off during onTime and on during offTime).

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
Example
// make output 1 steady on, output 2 and 3 flash at 100ms on, 200 off,
// and make output 4 flash opposite to 2 and 3.
outputs.onTime = 100;
outputs.offTime = 200;
outputs.state = 0x0009;
outputs.flash = 0x000E;

offTime :number

Gets/sets the off period when flashing. Period is in milliseconds.

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
See:
  • miob.Outputs.flash

<readonly> on :bool

Returns which outputs are steady or flashing. Same as (outputs.state | outputs.flash).

Do not use for WS API clients.

Type:
  • bool
Since:
  • 1.0 (WAT 1.0)

onTime :number

Gets/sets the on period when flashing. Period is in milliseconds.

Type:
  • number
Since:
  • 1.0 (WAT 1.0)
See:
  • miob.Outputs.flash

state :number

Gets/sets state of the outputs as a bitmask. Bit 1 for output 1, bit 2 for output 2, etc.

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

Methods


clear(mask)

Clears the outputs specified by the mask. Same as state &= ~mask. Can be connected to a signal.

Parameters:
Name Type Description
mask number
Since:
  • 1.0 (WAT 1.0)

set(mask)

Sets the outputs specified by the mask. Same as state |= mask. Can be connected to a signal.

Parameters:
Name Type Description
mask number
Since:
  • 1.0 (WAT 1.0)

setFlash(flash)

Sets the state of the flashing outputs. Same as writing to flash, but can be connected to a signal.

Parameters:
Name Type Description
flash number

New state of the flashing outputs.

Since:
  • 1.3 (WAT 1.4)

setState(state)

Sets the state of the outputs. Same as writing to state, but can be connected to a signal.

Parameters:
Name Type Description
state number

New state of the outputs.

Since:
  • 1.3 (WAT 1.4)

toggle(mask)

Toggles the outputs specified by the mask. Same as state ^= mask. Can be connected to a signal.

Parameters:
Name Type Description
mask number
Since:
  • 1.0 (WAT 1.0)

Events


flashChanged

Indicates that the flash state of the outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

offTimeChanged

Indicates that the off time for the flashing outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

onTimeChanged

Indicates that the on time for the flashing outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

solidChanged

Indicates that the solid state of the outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

stateChanged

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

Type: object
Properties:
Name Type Description
state number

Current state setting

flash number

Current flash setting

solid number

Outputs that are set, but not flashing

on number

Outputs that are set or flashing

off number

Outputs that are neither set nor flashing

onTime number

On time for flashing

offTime number

Off time for flashing

Since:
  • 1.0 (WAT 1.0)
Example
outputs.stateChanged.connect(function(state) {
   console.log('Outputs changed to ' + state.state);
});