From b45e0babfe348b20a5b738098754461e8f64dba5 Mon Sep 17 00:00:00 2001 From: tpollina Date: Wed, 15 Jan 2020 15:46:19 +0100 Subject: [PATCH] Update focus.py --- scripts/focus.py | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/scripts/focus.py b/scripts/focus.py index 79185fc..ab6bdcd 100644 --- a/scripts/focus.py +++ b/scripts/focus.py @@ -1,43 +1,28 @@ #!/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_motorkit import MotorKit from time import sleep - import sys nb_step = int(sys.argv[1]) orientation = str(sys.argv[2]) - - kit = MotorKit() - stage = kit.stepper2 - stage.release() -def focus(nb_step,orientation): - #0.25mm/step - #31um/microsteps - - stage.release() +#0.25mm/step +#31um/microsteps - if orientation == 'up': - for i in range(nb_step): - stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP) - sleep(0.001) - - if orientation == 'down': - for i in range(nb_step): - stage.onestep(direction=stepper.BACKWARD, style=stepper.MICROSTEP) - sleep(0.001) - - stage.release() +if orientation == 'up': + for i in range(nb_step): + stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP) + sleep(0.001) - -focus(nb_step, orientation) - +if orientation == 'down': + for i in range(nb_step): + stage.onestep(direction=stepper.BACKWARD, style=stepper.MICROSTEP) + sleep(0.001) + +stage.release()