Skip to content
Snippets Groups Projects

uPy stepper driver

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    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)
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment