Update focus.py
This commit is contained in:
parent
22045c9e8e
commit
b45e0babfe
|
@ -1,43 +1,28 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
#Focusing up for 345 micro steps :
|
|
||||||
#python3.7 path/to/file/focus.py 345 up
|
|
||||||
|
|
||||||
from adafruit_motor import stepper
|
from adafruit_motor import stepper
|
||||||
from adafruit_motorkit import MotorKit
|
from adafruit_motorkit import MotorKit
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
nb_step = int(sys.argv[1])
|
nb_step = int(sys.argv[1])
|
||||||
orientation = str(sys.argv[2])
|
orientation = str(sys.argv[2])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
kit = MotorKit()
|
kit = MotorKit()
|
||||||
|
|
||||||
stage = kit.stepper2
|
stage = kit.stepper2
|
||||||
|
|
||||||
stage.release()
|
stage.release()
|
||||||
|
|
||||||
def focus(nb_step,orientation):
|
#0.25mm/step
|
||||||
#0.25mm/step
|
#31um/microsteps
|
||||||
#31um/microsteps
|
|
||||||
|
|
||||||
stage.release()
|
if orientation == 'up':
|
||||||
|
|
||||||
if orientation == 'up':
|
|
||||||
for i in range(nb_step):
|
for i in range(nb_step):
|
||||||
stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP)
|
stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP)
|
||||||
sleep(0.001)
|
sleep(0.001)
|
||||||
|
|
||||||
if orientation == 'down':
|
if orientation == 'down':
|
||||||
for i in range(nb_step):
|
for i in range(nb_step):
|
||||||
stage.onestep(direction=stepper.BACKWARD, style=stepper.MICROSTEP)
|
stage.onestep(direction=stepper.BACKWARD, style=stepper.MICROSTEP)
|
||||||
sleep(0.001)
|
sleep(0.001)
|
||||||
|
|
||||||
stage.release()
|
stage.release()
|
||||||
|
|
||||||
|
|
||||||
focus(nb_step, orientation)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue