setPower method

  1. @override
Future<void> setPower(
  1. double powerPct, {
  2. Map<String, dynamic>? extra,
})
override

Sets the "percentage" of power the Motor should employ between -1 and 1. When powerPct is negative, the rotation will be in the backward direction.

// Set the power to  40% forwards.
await myMotor.setPower(0.4);

For more information, see Motor component.

Implementation

@override
Future<void> setPower(double powerPct, {Map<String, dynamic>? extra}) async {
  final request = SetPowerRequest()
    ..name = name
    ..powerPct = powerPct
    ..extra = extra?.toStruct() ?? Struct();
  await client.setPower(request);
}