Class Stepper
A stepper motor's place in its drive sequence, and how far it has turned.
public sealed class Stepper : IDisposable
- Inheritance
-
Stepper
- Implements
- Inherited Members
Examples
using var motor = new Stepper(StepDrive.HalfStep);
byte coils = motor.Step(StepDirection.Forward);
Constructors
Stepper(StepDrive)
Creates a stepper at the start of a pattern, with its position at zero.
public Stepper(StepDrive drive)
Parameters
driveStepDriveThe coil pattern to walk.
Exceptions
- PamojaException
The native stepper could not be created.
Properties
Coils
The coil pattern currently held, without advancing.
public byte Coils { get; }
Property Value
Steps
How many steps have been taken, signed by direction.
public int Steps { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Step(StepDirection)
Advances one step and returns the four-bit coil pattern to apply.
public byte Step(StepDirection direction)
Parameters
directionStepDirectionWhich way to turn.
Returns
- byte
The coil pattern; the most significant of the four bits is the first coil.
StepCount(StepDrive)
Returns how many steps one electrical cycle of a pattern takes.
public static int StepCount(StepDrive drive)
Parameters
driveStepDriveThe coil pattern.
Returns
- int
4for wave and full-step,8for half-step.
StepsForDegrees(float, uint)
Returns how many steps a rotation of an angle takes on a motor.
public static int StepsForDegrees(float degrees, uint stepsPerRevolution)
Parameters
degreesfloatThe angle to turn through.
stepsPerRevolutionuintThe motor's steps per full revolution.
Returns
- int
The step count, negative for a negative angle.