Create Focus_actuation.py

This commit is contained in:
tpollina 2019-12-10 12:06:56 -08:00 committed by GitHub
parent c17dc7deb7
commit f75fb0a198
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

27
Focus_actuation.py Normal file
View file

@ -0,0 +1,27 @@
from adafruit_motor import stepper
from adafruit_motorkit import MotorKit
from time import sleep
kit = MotorKit()
stage = kit.stepper1
stage.release()
def focus_actuation(steps,orientation):
stage.release()
if orientation == 'FORWARD':
for i in range(steps):
stage.onestep(direction=stepper.FORWARD, style=stepper.MICROSTEP)
sleep(0.001)
if orientation == 'BACKWARD':
for i in range(steps):
stage.onestep(direction=stepper.BACKWARD, style=stepper.MICROSTEP)
sleep(0.001)
stage.release()
focus_actuation(1000,'FORWARD')
focus_actuation(1000,'BACKWARD')