Table of Contents

Class Stepper

Namespace
Pamoja.Actuators
Assembly
Pamoja.Actuators.dll

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

drive StepDrive

The 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

byte

Steps

How many steps have been taken, signed by direction.

public int Steps { get; }

Property Value

int

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

direction StepDirection

Which 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

drive StepDrive

The coil pattern.

Returns

int

4 for wave and full-step, 8 for 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

degrees float

The angle to turn through.

stepsPerRevolution uint

The motor's steps per full revolution.

Returns

int

The step count, negative for a negative angle.