Skip to main content

Interface IVariableSpeedMotor

Represents an interface for controlling a motor with variable speed.

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

Properties

MaxVelocity

Gets the maximum run velocity for the motor

View Source
Declaration
AngularVelocity MaxVelocity { get; }

Methods

RunFor(TimeSpan, RotationDirection, AngularVelocity, CancellationToken)

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

View Source
Declaration
Task RunFor(TimeSpan runTime, RotationDirection direction, AngularVelocity angularVelocity, 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.
Meadow.Units.AngularVelocityangularVelocityThe AngularVelocity at which the motor should run (0 to 100).
System.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.

Run(RotationDirection, AngularVelocity, CancellationToken)

Runs the motor continuously with the given parameters.

View Source
Declaration
Task Run(RotationDirection direction, AngularVelocity angularVelocity, CancellationToken cancellationToken = default)
Returns

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

Parameters
TypeNameDescription
Meadow.Peripherals.RotationDirectiondirectionThe rotation direction of the motor.
Meadow.Units.AngularVelocityangularVelocityThe AngularVelocity at which the motor should run (0 to 100).
System.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.

RunFor(TimeSpan, RotationDirection, float, CancellationToken)

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

View Source
Declaration
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
Declaration
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.