Skip to main content

Interface IVariableSpeedMotor

Represents an interface for controlling a motor with variable speed.

Assembly: Meadow.Contracts.dll
View Source
public interface IVariableSpeedMotor : IMotor

Methods

RunFor(TimeSpan, RotationDirection, float, CancellationToken)

Runs the motor for a specified duration with the given parameters.

View Source
Task RunFor(TimeSpan runTime, RotationDirection direction, float speed = 100, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task: A task representing the asynchronous operation.

Parameters
TypeNameDescription
System.TimeSpanrunTimeThe duration for which the motor should run.
Meadow.Peripherals.RotationDirectiondirectionThe rotation direction of the motor.
System.SinglespeedThe speed (as a percentage) at which the motor should run (0 to 100).
System.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.

Run(RotationDirection, float, CancellationToken)

Runs the motor continuously with the given parameters.

View Source
Task Run(RotationDirection direction, float speed = 100, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task: A task representing the asynchronous operation.

Parameters
TypeNameDescription
Meadow.Peripherals.RotationDirectiondirectionThe rotation direction of the motor.
System.SinglespeedThe speed (as a percentage) at which the motor should run (0 to 100).
System.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.