Skip to content

Commit b2ca2d0

Browse files
committed
ex: read_tof.py
1 parent e7ab95b commit b2ca2d0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

examples/read_tof.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from arduino_alvik import ArduinoAlvik
2+
from time import sleep_ms
3+
import sys
4+
5+
alvik = ArduinoAlvik()
6+
alvik.begin()
7+
8+
while True:
9+
try:
10+
L, CL, C, CR, R = alvik.get_distance()
11+
T = alvik.get_distance_top()
12+
B = alvik.get_distance_bottom()
13+
print(f'T: {T} | B: {B} | L: {L} | CL: {CL} | C: {C} | CR: {CR} | R: {R}')
14+
sleep_ms(100)
15+
except KeyboardInterrupt as e:
16+
print('over')
17+
alvik.stop()
18+
sys.exit()

0 commit comments

Comments
 (0)