Skip to content

Commit 79786dc

Browse files
authored
Merge pull request adafruit#1196 from dherrada/master
Added astrophotography tracker code
2 parents fce94d1 + 92e2236 commit 79786dc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Astrophotography_Tracker/code.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import time
2+
import board
3+
import digitalio
4+
5+
worm_ratio = 40/1
6+
belt_ratio = 100/60
7+
gear_ratio = worm_ratio * belt_ratio
8+
9+
steps = 200 # Steps per revolution
10+
microsteps = 64 # Microstepping resolution
11+
total_steps = steps * microsteps # Total microsteps per revolution
12+
13+
wait = 1/ ((gear_ratio * total_steps) / 86400)
14+
15+
step = digitalio.DigitalInOut(board.D6)
16+
direct = digitalio.DigitalInOut(board.D5)
17+
18+
step.direction = digitalio.Direction.OUTPUT
19+
direct.direction = digitalio.Direction.OUTPUT
20+
21+
direct.value = True
22+
23+
while True:
24+
step.value = True
25+
time.sleep(0.001)
26+
step.value = False
27+
time.sleep(wait - 0.001)

0 commit comments

Comments
 (0)