Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4ed7f46

Browse files
committedAug 12, 2024
ex: modulino.py
1 parent 4379f32 commit 4ed7f46

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
 

‎examples/communication/modulino.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from arduino_alvik import ArduinoAlvik
2+
from time import sleep_ms
3+
import sys
4+
try:
5+
from modulino import ModulinoPixels
6+
except ImportError as e:
7+
print("ImportError: ModulinoPixels not installed")
8+
sys.exit(-1)
9+
10+
alvik = ArduinoAlvik()
11+
alvik.begin()
12+
13+
pixels = ModulinoPixels(alvik.i2c)
14+
15+
if not pixels.connected:
16+
print("🤷 No pixel modulino found")
17+
sys.exit(-2)
18+
19+
while True:
20+
try:
21+
for i in range(0, 8):
22+
pixels.clear_all()
23+
pixels.set_rgb(i, 255, 0, 0, 100)
24+
pixels.show()
25+
sleep_ms(50)
26+
27+
for i in range(7, -1, -1):
28+
pixels.clear_all()
29+
pixels.set_rgb(i, 255, 0, 0, 100)
30+
pixels.show()
31+
sleep_ms(50)
32+
33+
except KeyboardInterrupt as e:
34+
alvik.stop()
35+
sys.exit()

0 commit comments

Comments
 (0)
Please sign in to comment.