uPy stepper driver
The snippet can be accessed without any authentication.
Authored by
Jannis Konrad
stepper.py 321 B
from machine import Pin
a = Pin(4, Pin.OUT)
b = Pin(5, Pin.OUT)
c = Pin(12, Pin.OUT)
d = Pin(13, Pin.OUT)
steps = ((a, 1), (d, 0), (b, 1), (a,0), (c, 1), (b, 0), (d, 1), (c, 0))
s = 0
l = len(steps)
def step():
global s
st = steps[s]
st[0].value(st[1])
s += 1
if s >= l:
s = 0
print(s)
Please register or sign in to comment