trigger method

Future<void> trigger(
  1. List<int> digitalOutput
)

Assigns the digital outputs states.

Parameters

digital_output : array Vector of booleans to assign to digital outputs, starting at first output (O1).

Returns

void

Exceptions

INVALID_PARAMETER : if the length of the digital_output array is different from 2.

Implementation

Future<void> trigger(List<int> digitalOutput) async {
  final length = digitalOutput.length;

  if (length != 2) throw SenseException(SenseErrorType.INVALID_PARAMETER);

  int cmd = 0xB3; // 1 0 1 1 O2 O1 1 1 - set digital outputs

  for (int i = 0; i < length; i++) {
    if (digitalOutput[i] == 1) cmd |= 4 << i;
  }

  await _send(cmd);
}