passing parameters to python script on raspberry pi4

조회 수: 2 (최근 30일)
Ran Zeimer
Ran Zeimer 2021년 4월 3일
댓글: Ran Zeimer 2021년 4월 20일
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)

채택된 답변

Swetha Polemoni
Swetha Polemoni 2021년 4월 20일
Hi
This might help you.
system(['python filedirectory/file.py parm1 parm2']);
  댓글 수: 1
Ran Zeimer
Ran Zeimer 2021년 4월 20일
This a helpful first start
now i need to format the python script to accept the parameters
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Raspberry Pi Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by