Update Focus_actuation.py

This commit is contained in:
tpollina 2019-12-10 15:20:42 -08:00 committed by GitHub
parent 8e9bd56584
commit be2e0844e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,27 +1,30 @@
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
kit = MotorKit() kit = MotorKit()
stage = kit.stepper1 stage = kit.stepper1
stage.release() stage.release()
def focus_actuation(steps,orientation): def focus(steps,orientation):
#0.25mm/step
#31um/microsteps
stage.release() stage.release()
if orientation == 'FORWARD': if orientation == 'up':
for i in range(steps): for i in range(steps):
stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP) stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP)
sleep(0.001) sleep(0.001)
if orientation == 'BACKWARD': if orientation == 'down':
for i in range(steps): for i in range(steps):
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_actuation(1000,'FORWARD') focus_actuation(1000,'up')
focus_actuation(1000,'BACKWARD') focus_actuation(1000,'down')