Library for Arduino Author: Francesco Artur Perrotti Contact: faperrotti@hotmail.com
This library implements a class that takes care to synchronize two stepper motors to produce programmed motions. All methods are non-blocking and library works with unipolar or bipolar stepper motors. Advanced features were implemented for vibration reduction, energy saving and protection of control circuits.
The library intents to generate signals to ULN2003/2803 based boards or equivalent circuit to drive unipolar motors and also boards with double h-bridge to drive bipolar motors. These boards do not have the advanced features that are typically found in boards like Easy Driver or Pololu boards based on A4988. So, this library try provide a better and safe control with no hardware resources.
Note: This version uses TimerOne library to control the timer. This library is not included on package but you can download from Timer1 page.
https://code.google.com/p/stepper-robot-arduino-lib/wiki/Reference (english) https://fperrotti.wikispaces.com/Stepper+Lib+Arduino (portuguese).
Below the class as seen by the application.
class StepperRobot{ public: // setup void init(int startSpeed, int cruiseSpeed, int pulsesToCruise); void initLeftMotor(int mPin_1, int mPin_2, int mPin_3, int mPin_4); void initRightMotor(int mPin_1, int mPin_2, int mPin_3, int mPin_4); // Movements boolean move(char movType, int pulses); boolean isMoving(); void decelStop(); void stopNow(); // Bufferized movements boolean addMove(int movType, int pulses); void goNow(); void stopAndClear(); // Config void turboOn(); void turboOff(); void halfStepOn(); void halfStepOff(); void setCutPercent(float initialCutPercent) };
And here the move types implemented
#define mvAhead 0 #define mvBack 1 #define mvSpinL 2 #define mvSpinR 3 #define mvTurnL 4 #define mvTurnR 5 #define mvBkTurnL 6 #define mvBkTurnR 7 #define mvBrake 8
A video with a simple robot testing this movements can be seen here (YouTube).
If you want to help to improve this lib, please join the project at Google Code: https://code.google.com/p/stepper-robot-arduino-lib/
There is a thread in forum for discussions, suggestions, bug reports, etc.
I hope you enjoy this lib.
regards,
Perrotti