planktoscope/scripts/focus.py

29 lines
610 B
Python
Raw Normal View History

2019-12-13 19:38:55 +01:00
#!/usr/bin/env python
2019-12-13 21:30:57 +01:00
2019-12-13 19:38:55 +01:00
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()
2019-12-13 23:40:35 +01:00
stage = kit.stepper2
2019-12-13 19:38:55 +01:00
stage.release()
2020-01-15 15:46:19 +01:00
#0.25mm/step
#31um/microsteps
2019-12-13 19:38:55 +01:00
2020-01-15 15:46:19 +01:00
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)
2019-12-13 19:38:55 +01:00
2020-01-15 15:46:19 +01:00
stage.release()