Difference between revisions of "Pi Pico driving stepper with clear wiring diagram"

From MyWiki
Jump to: navigation, search
(Created page with "Reference :- https://microcontrollerslab.com/28byj-48-stepper-motor-raspberry-pi-pico-micropython/ <source lang="python"> from machine import Pin import utime pins = [ P...")
 
(No difference)

Latest revision as of 10:37, 7 September 2023

Reference :- https://microcontrollerslab.com/28byj-48-stepper-motor-raspberry-pi-pico-micropython/

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]
      ]
n = 0
while (n < 100):
    n = n + 1
    print(n)
    for step in full_step_sequence:
        for i in range(len(pins)):
            pins[i].value(step[i])
            utime.sleep(0.001)