setPwm method

  1. @override
Future<void> setPwm(
  1. String pin,
  2. double dutyCyclePct, {
  3. Map<String, dynamic>? extra,
})
override

Set the duty cycle of the given pin of a board.

// Set the PWM duty cycle of pin 13
await myBoard.setPwm('13', 0.6);

For more information, see Board component.

Implementation

@override
Future<void> setPwm(String pin, double dutyCyclePct, {Map<String, dynamic>? extra}) async {
  final request = SetPWMRequest()
    ..name = name
    ..pin = pin
    ..dutyCyclePct = dutyCyclePct
    ..extra = extra?.toStruct() ?? Struct();
  await client.setPWM(request);
}