kopia lustrzana https://github.com/zhcong/ULN2003-for-ESP32
Allow negative step count and angle for backward rotation
motor.angle(-90) == motor.angle(90, -1) motor.step(-500) == motor.step(500, -1)pull/4/head
rodzic
b0d7349b4e
commit
643fb5b91e
|
@ -37,6 +37,9 @@ class Stepper:
|
|||
|
||||
def step(self, count, direction=1):
|
||||
"""Rotate count steps. direction = -1 means backwards"""
|
||||
if count<0:
|
||||
direction = -1
|
||||
count = -count
|
||||
for x in range(count):
|
||||
for bit in self.mode[::direction]:
|
||||
self.pin1(bit[0])
|
||||
|
|
Ładowanie…
Reference in New Issue