Class Uln2003
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
pin1intThe GPIO pin number which corresponds pin A on ULN2003 driver board.
pin2intThe GPIO pin number which corresponds pin B on ULN2003 driver board.
pin3intThe GPIO pin number which corresponds pin C on ULN2003 driver board.
pin4intThe GPIO pin number which corresponds pin D on ULN2003 driver board.
controllerGpioControllerThe controller.
shouldDisposeboolTrue to dispose the Gpio Controller.
stepsToRotateintAmount 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
RPM
Gets or sets the motor speed to revolutions per minute.
public short RPM { get; set; }
Property Value
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
rotationsintNumber 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
stepsintNumber of steps.
Stop()
Stop the motor.
public void Stop()