-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathledborg
executable file
·48 lines (39 loc) · 1.15 KB
/
ledborg
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
# coding: Latin-1
import sys
###########################################################
# This is a simple script to interact with the LedBorg
# RGB LED add on board for RaspBerry Pi.
###########################################################
# To be used with the LedBorg:
# http://www.piborg.org/ledborg
#
# Script based on:
# http://www.piborg.org/downloads/ledborg/cheerlights.txt
#
###########################################################
# Setup paramters
colorMap = { "off":"000",
"red":"200",
"green":"020",
"blue":"002",
"cyan":"022",
"white":"111",
"warmwhite":"222",
"purple":"102",
"magenta":"202",
"yellow":"220",
"orange":"210"}
# Loop indefinitely
if len(sys.argv) <= 1:
print "No arguments given. Write a color name."
sys.exit()
colorName = sys.argv[1]
if not colorMap.has_key(colorName):
print "Unknown color. Use the following:"
print colorMap.keys()
sys.exit()
ledBorgColor = colorMap[colorName]
ledBorg = open('/dev/ledborg', 'w')
ledBorg.write(ledBorgColor)
ledBorg.close()