Table of Contents

Class Uln2003

Namespace
Iot.Device.Uln2003
Assembly
Iot.Device.Uln2003.dll

This class is for controlling stepper motors that are controlled by a 4 pin controller board.

public class Uln2003
Inheritance
Uln2003

Remarks

It is tested and developed using the 28BYJ-48 stepper motor and the ULN2003 driver board.

Constructors

Uln2003(int, int, int, int, GpioController?, bool, int)

Initializes a new instance of the Uln2003 class.

public Uln2003(int pin1, int pin2, int pin3, int pin4, GpioController? controller = null, bool shouldDispose = true, int stepsToRotate = 4096)

Parameters

pin1 int

The GPIO pin number which corresponds pin A on ULN2003 driver board.

pin2 int

The GPIO pin number which corresponds pin B on ULN2003 driver board.

pin3 int

The GPIO pin number which corresponds pin C on ULN2003 driver board.

pin4 int

The GPIO pin number which corresponds pin D on ULN2003 driver board.

controller GpioController

The controller.

shouldDispose bool

True to dispose the Gpio Controller.

stepsToRotate int

Amount of steps needed to rotate motor once in HalfStepMode.

Properties

Mode

Gets or sets the stepper's mode.

public StepperMode Mode { get; set; }

Property Value

StepperMode

RPM

Gets or sets the motor speed to revolutions per minute.

public short RPM { get; set; }

Property Value

short

Remarks

Default revolutions per minute for 28BYJ-48 is approximately 15.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Rotate(int)

Rotates the motor. If the number is negative, the motor moves in the reverse direction.

public void Rotate(int rotations)

Parameters

rotations int

Number of rotations.

Step(int)

Moves the motor. If the number is negative, the motor moves in the reverse direction.

public void Step(int steps)

Parameters

steps int

Number of steps.

Stop()

Stop the motor.

public void Stop()