如何在Jetson Nano上运行5v步进电机

时间:2019-06-01 22:35:56

标签: python-3.x stepper nvidia-jetson

我尝试在jetson nano上使用RPI代码运行5v步进电机,它给我ValueError:在JETSON_NANO板上发送的通道无效

我已经安装了jetson gpio并仍然给我同样的错误,但是代码在树莓派上工作正常

import Jetson.GPIO as GPIO
#import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
#GPIO.setmode(GPIO.BOARD)
control_pins = [3,5,7,11]
for pin in control_pins:
    GPIO.setup(pin, GPIO.OUT)
    GPIO.output(pin, 0)
halfstep_seq = [
    [1,0,0,0],
    [1,1,0,0],
    [0,1,0,0],
    [0,1,1,0],
    [0,0,1,0],
    [0,0,1,1],
    [0,0,0,1],
    [1,0,0,1]
]
for i in range(56):
    for halfstep in range(8):
      for pin in range(4):
        GPIO.output(control_pins[pin], halfstep_seq[halfstep][pin])
      time.sleep(0.001)
GPIO.cleanup()

1 个答案:

答案 0 :(得分:0)

您需要使用开发板底部的Dxx标签所指示的数字: enter image description here

因此,假设我们要使用物理引脚3、5、7和11,则control_pins数组应为[2, 3, 4, 17]