我正在使用Python 3.7在Raspberry Pi 4上玩NEM17步进电机。3和A4988步进电机驱动器。我运行下面的代码,它工作良好,但在代码完成后,步进电机继续以一种有点零散的方式转动。如何让它在完成代码后停止?我在下面包含了我正在使用的代码。
# import the library
from RpiMotorLib import RpiMotorLib
#define GPIO pins
GPIO_pins = (17, 27, 22) # Microstep Resolution MS1-MS3 -> GPIO Pin
direction= 24 # Direction -> GPIO Pin
step = 23 # Step -> GPIO Pin
# Declare an named instance of class pass GPIO pins numbers
mymotortest = RpiMotorLib.A4988Nema(direction, step, GPIO_pins, "A4988")
# call the function, pass the arguments
mymotortest.motor_go(False, "Half" , 500, .001, False, .05)
# good practise to cleanup GPIO at some point before exit
GPIO.cleanup()```
P.S I was wondering what would be the best library or way to control a stepper motor? As in, is this the best library to be using or are there better and more precise methods in doing so.
Thank you
也许是GPIO。清除将gpio输出置于未定义的浮动状态。尝试在GPIO之前将A4988置于睡眠模式。清理。A4988 pdf