dac method

Future<void> dac(
  1. int pwmOutput
)

Assigns the analog (PWM) output value (%ScientISST 2 only).

Parameters

pwm_output : int Analog output value to set (0...255).

Returns

void Exceptions

INVALID_PARAMETER : if the pwm_output value is outside of its range, 0-255.

Implementation

/// Exceptions
/// ----------
/// [INVALID_PARAMETER] : if the pwm_output value is outside of its range, 0-255.
Future<void> dac(int pwmOutput) async {
  if (pwmOutput < 0 || pwmOutput > 255)
    throw SenseException(SenseErrorType.INVALID_PARAMETER);

  int cmd = 0xA3; // 1 0 1 0 0 0 1 1 - Set dac output
  cmd |= pwmOutput << 8;

  await _send(cmd);
}