Behrooz
Tahanzadeh


“BtStepper” class introduction

Stepper motors are great! they’re as flexible, simple and lovely as Arduino; and I think we can deal with them much easier than the way Stepper class works. So I’ve developed BtStepper motor class as a part of BtMicro library. The most significant difference between Stepper class and BtStepper is the method they add delay before taking each step.

Actually BtStepper class is designed to drive stepper motors only one step forward or backward! and it’s up to developer to add sufficient delay which is useful when more than one motor should rotate simultaneously.

Reverse property

In many cases the structural and logical rotation directions are opposite to each other, for example when something is elevated by a stepper, it logically suggests that the stepper should rotate in positive direction, but because of its situation you have to decrease the step number. In these conditions, reverse property of BtStepper objects, can solve this problem and change their behavior. The default value for this property is false.

Increment/Decrement operators

Talking about single step always reminds us of ++/−− operators. BtStepper utilizes them and provides a simple clear API for developer to change step number.

BtStepper motorA(4,5,6,7);
BtStepper motorB(8,9);

//Set reverse property of stepper motor motorB.reverse = true;

//Two steppers will rotate 100 step, in opposite direction simultaneously for(int i=0; i<100; i++) { motorA++; motorB++; delay(5); }


Repository: BtStepper on Github
Programming Language: C++