|
TinyRobotics
|
Stepper motor driver using FastAccelStepper for Arduino. More...
#include <StepperMotor.h>


Public Member Functions | |
| StepperMotor (uint8_t id=0) | |
| StepperMotor (uint8_t id, uint16_t stepsPerRevolution, float maxSpeedStepsPerSec, uint16_t accelerationMs) | |
| void | setPins (int stepPin, int dirPin, int enablePin=-1) |
| void | setMaxSpeed (float stepsPerSec) |
| void | setAccelerationMs (uint16_t ms) |
| Set acceleration time in milliseconds to reach max speed (e.g., 2000 ms) | |
| void | setStepsPerRevolution (int steps) |
| bool | begin () |
| bool | setValuePercent (T percent) override |
| T | getValuePercent () const override |
| void | end () override |
| Stop the stepper motor. | |
| bool | isPinsSet () const override |
Public Member Functions inherited from IMotor< T > | |
| virtual bool | begin ()=0 |
| virtual void | end ()=0 |
| virtual bool | isPinsSet () const =0 |
| virtual bool | setValuePercent (T percent)=0 |
| virtual T | getValuePercent () const =0 |
| void | setID (uint8_t id) |
| uint8_t | getID () const |
Protected Member Functions | |
| void | callbackFastAccel (FastAccelStepper *s) |
| void | setSpeedPercent (T percent) |
Protected Attributes | |
| T | lastValuePercent = 0.0f |
| FastAccelStepperEngine | engine |
| FastAccelStepper * | stepper = NULL |
| int | pinStep = -1 |
| int | pinDir = -1 |
| int | pinEnable = -1 |
| bool | is_pins_set = false |
| float | maxSpeedHz = 2000 |
| uint16_t | accelerationMs = 2000 |
| uint16_t | stepsPerRevolution = 200 |
| void * | ref = nullptr |
| void(* | callback )(void *) = nullptr |
Protected Attributes inherited from IMotor< T > | |
| uint8_t | id = 0 |
Stepper motor driver using FastAccelStepper for Arduino.
This class provides an interface to control stepper motors with acceleration and speed control. It supports:
You can set pins, maximum speed, acceleration, and steps per revolution. The motor can be started, stopped, or moved by distance or revolutions. Acceleration is handled automatically based on the configured accelerationMs.
The class uses FastAccelStepper's continuous mode for setSpeed(), and supports asynchronous notification via callback for move operations.
@dependencies
Main methods:
Usage notes:
Example usage:
|
inlinevirtual |
Initialize the stepper hardware. Must be called after setting pins and speed parameters.
Implements IMotor< T >.
|
inlineoverridevirtual |
Stop the stepper motor.
Implements IMotor< T >.
|
inlineoverridevirtual |
Implements IMotor< T >.
|
inlineoverridevirtual |
Implements IMotor< T >.
|
inline |
Set maximum speed in steps per second (e.g., 500 for 1.8 degree stepper, 1000
|
inline |
Set the number of steps per full revolution (e.g., 200 for 1.8 degree stepper)
|
inlineoverridevirtual |
Set continuous speed as a percentage (-100 to 100). Positive for forward, negative for backward.
Implements IMotor< T >.