forked from seanbechhofer/raspberrypi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLedBorg.py
More file actions
49 lines (45 loc) · 1.33 KB
/
LedBorg.py
File metadata and controls
49 lines (45 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
import time
class LedBorg:
colours = {"maroon":"100",
"red":"200",
"pink":"211",
"olive":"110",
"yellow":"220",
"lightyellow":"221",
"green":"010",
"limegreen":"020",
"lightgreen":"121",
"teal":"011",
"cyan":"022",
"lightcyan":"122",
"navy":"001",
"blue":"002",
"lightblue":"112",
"purple":"101",
"magenta":"202",
"fuchsiapink":"212",
"black":"000",
"grey":"111",
"white":"222",
"azure":"012",
"violet":"102",
"brightpink":"201",
"chartreuse":"120",
"guppiegreen":"021",
"orange":"210"}
def show(self,colour="red"):
"""Show the given colour"""
# Open the LedBorg driver
dev = open('/dev/ledborg', 'w')
# Set LedBorg to the new colour
dev.write(self.colours[colour])
# Close
dev.close()
if __name__ == "__main__":
lb = LedBorg()
while True:
for colour in lb.colours:
print colour
lb.show(colour)
time.sleep(2)