Expand description
Coil sequencing for four-wire stepper motors.
A stepper turns by energising its coils in a repeating pattern; stepping through the pattern in one direction or the other advances or reverses the shaft. This module holds the three standard drive patterns and a sequencer that walks them, so a caller toggles the four coil lines (directly, or through a darlington array like the ULN2003) without hand-maintaining the sequence. It also models the step-and-direction interface of driver chips such as the A4988 and DRV8825, which take a step pulse and a direction level and track position as a signed count.
Coil patterns are four bits, the most significant being the first coil (IN1 on a ULN2003 board) down to the least significant (IN4).
Structs§
- Position
- A signed step counter for step-and-direction driver chips.
- Sequencer
- A position in a drive sequence, walked one step at a time.
Enums§
Functions§
- steps_
for_ degrees - Converts an angle to a whole number of steps for a given motor.