Update pipeline.py
This commit is contained in:
parent
39fef41e38
commit
9c4e387f4b
|
@ -1,11 +1,38 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
from adafruit_motor import stepper
|
||||||
|
from adafruit_motorkit import MotorKit
|
||||||
|
from time import sleep
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
#get the value of the first parameter which is for example an integer
|
nb_step = int(sys.argv[1])
|
||||||
value = int(sys.argv[1])
|
orientation = str(sys.argv[2])
|
||||||
|
|
||||||
#get the value of the first parameter which is for example a string
|
|
||||||
string = str(sys.argv[2])
|
|
||||||
|
|
||||||
#Execute a python cmd with the previous defined variables from php
|
#Execute a python cmd with the previous defined variables from php
|
||||||
|
|
||||||
|
|
||||||
|
kit = MotorKit()
|
||||||
|
|
||||||
|
stage = kit.stepper1
|
||||||
|
|
||||||
|
stage.release()
|
||||||
|
|
||||||
|
def focus(steps,orientation):
|
||||||
|
#0.25mm/step
|
||||||
|
#31um/microsteps
|
||||||
|
|
||||||
|
stage.release()
|
||||||
|
|
||||||
|
if orientation == 'up':
|
||||||
|
for i in range(steps):
|
||||||
|
stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP)
|
||||||
|
sleep(0.001)
|
||||||
|
|
||||||
|
if orientation == 'down':
|
||||||
|
for i in range(steps):
|
||||||
|
stage.onestep(direction=stepper.BACKWARD, style=stepper.MICROSTEP)
|
||||||
|
sleep(0.001)
|
||||||
|
|
||||||
|
stage.release()
|
||||||
|
|
||||||
|
focus(nb_step,orientation)
|
||||||
|
|
Loading…
Reference in a new issue