树莓派一个
步进减速电机 5V 4相5线 28BYJ-48-5V
ULN2003 驱动板 步进电机用
电源不说了,跟树莓派连接,真正控制进步机的是 IN1-4,我们现在上代码
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
chan_list = [32,36,38,40]
GPIO.setmode(GPIO.BOARD)
GPIO.setup(chan_list,GPIO.OUT)
GPIO.output(chan_list, GPIO.LOW)
#正转
#seq=[(1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)]
#反转
seq=[(0,0,0,1),(0,0,1,0),(0,1,0,0),(1,0,0,0)]
spend=0.002
runNO=1
ratio=512
try:
i=0
sumCount=ratio*runNO
while i