noka @willow-micro / AsyncStepper
Embed: (wiki syntax)

« Back to documentation index

AsyncStepper Class Reference

AsyncStepper Class Reference

Drive a stepper motor using A4988 with asynchronous. More...

#include <AsyncStepper.hpp>

Public Member Functions

 AsyncStepper (PinName enablePin, PinName stepPin, PinName dirPin, uint32_t rpm, stepMode_e stepMode=FULL, PinName ms1Pin=NC, PinName ms2Pin=NC, PinName ms3Pin=NC, uint32_t oneRotationFullSteps=200, stopMode_e stopMode=FREE)
 Create a new AsyncStepper port.
virtual ~AsyncStepper ()
 Destrutor of AsyncStepper.
virtual void SetRPM (uint32_t rpm)
 Set RPM of the stepper motor.
virtual void SetStepMode (stepMode_e stepMode)
 Set division ratio of the stepper motor.
virtual void Enable (void)
 Apply the current to the stepper motor.
virtual void Disable (void)
 Stop the current to the stepper motor.
virtual bool IsStopping (void)
 Check the stepper motor stopping.
virtual void Rotate (direction_e direction, uint32_t steps)
 Rotate the stepper motor.

Detailed Description

Drive a stepper motor using A4988 with asynchronous.

Definition at line 47 of file AsyncStepper.hpp.


Constructor & Destructor Documentation

AsyncStepper ( PinName  enablePin,
PinName  stepPin,
PinName  dirPin,
uint32_t  rpm,
stepMode_e  stepMode = FULL,
PinName  ms1Pin = NC,
PinName  ms2Pin = NC,
PinName  ms3Pin = NC,
uint32_t  oneRotationFullSteps = 200,
stopMode_e  stopMode = FREE 
)

Create a new AsyncStepper port.

Parameters:
enablePinA4988 Enable pin
stepPinA4988 Step pin
dirPinA4988 Direction pin
rpmRPM
stepModeDivision ratio
ms1PinA4988 MS1
ms2PinA4988 MS2
ms3PinA4988 MS1
oneRotationFullStepsSteps per rotation of your stepper motor
stopModeEnable/Disable holding torque

Definition at line 17 of file AsyncStepper.cpp.

~AsyncStepper (  ) [virtual]

Destrutor of AsyncStepper.

Definition at line 36 of file AsyncStepper.cpp.


Member Function Documentation

void Disable ( void   ) [virtual]

Stop the current to the stepper motor.

Definition at line 96 of file AsyncStepper.cpp.

void Enable ( void   ) [virtual]

Apply the current to the stepper motor.

Definition at line 89 of file AsyncStepper.cpp.

bool IsStopping ( void   ) [virtual]

Check the stepper motor stopping.

Return values:
trueYes (Stopping)
falseNo

Definition at line 103 of file AsyncStepper.cpp.

void Rotate ( direction_e  direction,
uint32_t  steps 
) [virtual]

Rotate the stepper motor.

Parameters:
directionPOSITIVE or NEGATIVE
stepsSteps of rotation

Definition at line 108 of file AsyncStepper.cpp.

void SetRPM ( uint32_t  rpm ) [virtual]

Set RPM of the stepper motor.

Parameters:
rpm

Definition at line 67 of file AsyncStepper.cpp.

void SetStepMode ( stepMode_e  stepMode ) [virtual]

Set division ratio of the stepper motor.

Parameters:
stepModedivision ratio

Definition at line 80 of file AsyncStepper.cpp.