Skip to main content

Class GpioStepperBase

Represents an abstract GPIO-based stepper motor.

Assembly: GpioStepper.dll​
View Source​
Declaration
public abstract class GpioStepperBase : IStepperMotor, IPositionalMotor, IVariableSpeedMotor, IMotor

Derived:
Meadow.Foundation.Motors.Stepper.CwCcwStepper

Implements:
Meadow.Peripherals.Motors.IStepperMotor, Meadow.Peripherals.Motors.IPositionalMotor, Meadow.Peripherals.Motors.IVariableSpeedMotor, Meadow.Peripherals.Motors.IMotor

Properties​

Direction​

Gets the current rotation direction of the motor.

View Source​
Declaration
public RotationDirection Direction { get; protected set; }

Position​

Gets the current position of the motor.

View Source​
Declaration
public abstract Angle Position { get; }

IsMoving​

Gets a value indicating whether the motor is currently in motion.

View Source​
Declaration
public abstract bool IsMoving { get; }

MaxVelocity​

Gets the maximum run velocity for the motor

View Source​
Declaration
public abstract AngularVelocity MaxVelocity { get; }

StepsPerRevolution​

Gets the number of steps required for the stepper motor to complete one full revolution.

View Source​
Declaration
public abstract int StepsPerRevolution { get; }

Methods​

Rotate(int, RotationDirection, Frequency, CancellationToken)​

Rotates the stepper motor by the specified number of steps in the specified direction with the given frequency.

View Source​
Declaration
public abstract Task Rotate(int steps, RotationDirection direction, Frequency rate, CancellationToken cancellationToken = default)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
System.Int32stepsThe number of steps to rotate the motor.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to rotate the motor.
Meadow.Units.FrequencyrateThe frequency of the steps at which to rotate the motor.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

Stop(CancellationToken)​

Stops the motor.

View Source​
Declaration
public abstract Task Stop(CancellationToken cancellationToken = default)
Returns​

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

Parameters​
TypeNameDescription
System.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.

ResetPosition(CancellationToken)​

Resets the position of the motor.

View Source​
Declaration
public abstract Task ResetPosition(CancellationToken cancellationToken = default)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

GetFrequencyForVelocity(AngularVelocity)​

Gets the frequency corresponding to the specified angular velocity.

View Source​
Declaration
protected Frequency GetFrequencyForVelocity(AngularVelocity velocity)
Returns​

Meadow.Units.Frequency: The frequency required for the specified angular velocity.

Parameters​
TypeNameDescription
Meadow.Units.AngularVelocityvelocityThe angular velocity.

GoTo(Angle, AngularVelocity, CancellationToken)​

Moves the motor to the specified position with the given velocity.

View Source​
Declaration
public Task GoTo(Angle position, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
Meadow.Units.AnglepositionThe target position to move to.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the movement.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

GoTo(Angle, RotationDirection, AngularVelocity, CancellationToken)​

Moves the motor to the specified position and direction with the given velocity.

View Source​
Declaration
public Task GoTo(Angle position, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
Meadow.Units.AnglepositionThe target position to move to.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to move the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the movement.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

Rotate(Angle, RotationDirection, AngularVelocity, CancellationToken)​

Rotates the motor by the specified angle and direction with the given velocity.

View Source​
Declaration
public Task Rotate(Angle amountToRotate, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
Meadow.Units.AngleamountToRotateThe angle by which to rotate the motor.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to rotate the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the rotation.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

Run(RotationDirection, AngularVelocity, CancellationToken)​

Runs the motor in the specified direction with the given velocity.

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

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to run the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the run.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

RunFor(TimeSpan, RotationDirection, AngularVelocity, CancellationToken)​

Runs the motor for a specified duration in the specified direction with the given velocity.

View Source​
Declaration
public Task RunFor(TimeSpan runTime, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns​

System.Threading.Tasks.Task

Parameters​
TypeNameDescription
System.TimeSpanrunTimeThe duration for which to run the motor.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to run the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the run.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

Run(RotationDirection, float, CancellationToken)​

Runs the motor continuously with the given parameters.

View Source​
Declaration
public Task Run(RotationDirection direction, float speed, 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.

RunFor(TimeSpan, RotationDirection, float, CancellationToken)​

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

View Source​
Declaration
public virtual Task RunFor(TimeSpan runTime, RotationDirection direction, float speed, 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.

RunFor(TimeSpan, RotationDirection, CancellationToken)​

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

View Source​
Declaration
public Task RunFor(TimeSpan runTime, RotationDirection direction, 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.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.

Run(RotationDirection, CancellationToken)​

Runs the motor continuously with the given parameters.

View Source​
Declaration
public Task Run(RotationDirection direction, 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.Threading.CancellationTokencancellationTokenOptional cancellation token to stop the operation.

Implements​

  • Meadow.Peripherals.Motors.IStepperMotor
  • Meadow.Peripherals.Motors.IPositionalMotor
  • Meadow.Peripherals.Motors.IVariableSpeedMotor
  • Meadow.Peripherals.Motors.IMotor