passing parameters to python script on raspberry pi4
1 次查看(过去 30 天)
显示 更早的评论
I have a script on raspberry pi4 that controls a stepper motor using rpimotorlib. i can call the script from matlab using 'system' but i do not know the syntax to pass parameters used in the script:
from RpiMotorLib import RpiMotorLib
#define GPIO pins
#motor pin
GPIO_pins = (25,8,7) # Microstep Resolution MS1-MS3 -> GPIO Pin
direction= 20 # Direction Pin,
step = 21 # Step Pin
distance = 200 # Default move 1mm => 80 steps per mm
# Declare an named instance of class pass GPIO pins numbers
mymotortest = RpiMotorLib.A4988Nema(direction, step, GPIO_pins, "A4988")
mymotortest.motor_go(False, "Full" , distance, 0.01 , False, .05)
0 个评论
采纳的回答
Swetha Polemoni
2021-4-20
Hi
This might help you.
system(['python filedirectory/file.py parm1 parm2']);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!