It is based on this article. The Stepmotors described there can be found [here] (http://www.ebay.de/itm/290974735618?clk_rvr_id=1055052146819&rmvSB=true) or here. Those are unipolar 5 pin motors. This is the datasheet.
##Usage
Put stepmotor.py (located in /bin) into your working directory and import it with from stepmotor import Stepmotor
. You can now create an object with motor = Stepmotor()
and use this object.
Following methods are available:
- use
turnSteps(n)
for turning n steps - use
turnDegrees(n)
for turning n degrees (small values can lead to inaccuracy) - use
turnDistance(distance, radius)
turn for translation of wheels or a coil (inaccuracies involved e.g. due to thickness of rope)
See the example below.
from stepmotor import Stepmotor
from time import sleep
print("moving started")
motor = Stepmotor()
print("One Step")
motor.turnSteps(1)
sleep(0.5)
print("20 Steps")
motor.turnSteps(20)
sleep(0.5)
print("quarter turn")
motor.turnDegrees(90)
print("moving stopped")
motor.close()
It is important, that you close with
close()
when you are done.