Pi Pico driving steppers

From MyWiki
Jump to: navigation, search

Reference:- https://www.youngwonks.com/blog/How-to-use-a-stepper-motor-with-the-Raspberry-Pi-Pico

from machine import Pin
import utime
 
pins = [
    Pin(15,Pin.OUT),#IN1
    Pin(14,Pin.OUT),#IN1
    Pin(16,Pin.OUT),#IN1
    Pin(17,Pin.OUT),#IN1
       ]
 
full_step_sequence = [
    [1,0,0,0],
    [0,1,0,0],
    [0,0,1,0],
    [0,0,0,1]
      ]
 
while True:
    for step in full_step_sequence:
        for i in range(len(pins)):
            pins[i].value(step[i])
            utime.sleep(0.001)