Update and rename main.py to focus.py
This commit is contained in:
parent
92bcc52225
commit
1d68a1aac2
39
scripts/focus.py
Normal file
39
scripts/focus.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
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.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)
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
Loading…
Reference in a new issue