jung6717 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Half-steps in stepper library for 4-wire motors #139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using a half-step-library would double the precision of the stepper. 

Attached you'll find my proposal for the changed Stepper library. I kept 
the changes to a minimum.
It contains a new (added) constructor, a private boolean which indicates 
whether or not to use the half-step system. The Stepper::step function was 
changed to allow 2, 4, or 8 steps and the Stepper::stepMotor was changed 
to send the 8 different signals to the 4 wires.

Users who created sketches using the previous lib can change to this new 
library without compatibility problems. 

Original issue reported on code.google.com by john.zan...@gmail.com on 5 Nov 2009 at 7:28

Attachments:

GoogleCodeExporter commented 9 years ago
nice addition, Works well, for anyone else trying this you need to remember 
when 
declaring the stepper object to double the original step number otherwise it 
will 'jump' on certain steps.  so if you usually declare:
Stepper myStepper = Stepper(20,2,3,4,5);

for half stepping it should now be:
stepper MyStepper = Stepper(40,2,3,4,5,1);

Original comment by r3gin4ld@hotmail.com on 8 Nov 2009 at 10:52

GoogleCodeExporter commented 9 years ago
This seems to work very well!

However, i find i can get a slower step speed (which i am using for the seconds 
movement of a clock) by 'lying' to the lib and telling it i have 200 steps 
instead of 
400.  Could the step speed calculation be adjusted to avoid this?

Original comment by magrat...@gmail.com on 12 Nov 2009 at 12:44

GoogleCodeExporter commented 9 years ago
It works great but you'll have to change #include "WProgram.h" to #include 
"Arduino.h" in order to work with IDE 1.0.1

Original comment by nikit...@gmail.com on 30 Mar 2013 at 3:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
good work, works with me, make sure you backup the old library files with a 
name other than Stepper_bak, or Stepper_old, seems the compiler will use them - 
even though they are renamed - and you'll get errors of multiple instance of 
variables, etc.

Original comment by chris.wo...@gmail.com on 10 Mar 2014 at 5:07

GoogleCodeExporter commented 9 years ago
Excellent mod.  Just added ",1" to the list of arguments for the Stepper 
command in my existing program to make it use half steps!  Can't get much 
easier than that.

Original comment by mich...@exactbuilt.com on 2 Jul 2014 at 10:56

GoogleCodeExporter commented 9 years ago
..yes works nicely, note that people will have to change the #include 
"WProgram.h" in Stepper.cpp to #include "Arduino.h". In linux/Ubuntu14.04  the 
Stepper.cpp and Stepper.h files were in  
/opt/arduino-nightly/libraries/Stepper/src/  directories.

thanks a lot John :)

Original comment by cdun...@yahoo.com on 2 Jun 2015 at 10:28