Created
November 17, 2014 22:39
-
-
Save Akkiesoft/c61078527f67eac8b26e to your computer and use it in GitHub Desktop.
UNICORN HATでミクさんを出すやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import unicornhat as UH | |
import time | |
data = [ | |
'01000010', | |
'81888818', | |
'87887888', | |
'87787788', | |
'87778778', | |
'87677678', | |
'87777778', | |
'87733778' | |
] | |
# 0 = #000000 | |
# 1 = #7d074b | |
# 3 = #b83e3e | |
# 6 = #0000ff | |
# 7 = #efe8a4 | |
# 8 = #3eb8a5 | |
for y in range(8): | |
for x in range(8): | |
c = data[y][x] | |
r = 0 | |
g = 0 | |
b = 0 | |
if c == '1': | |
r = 125 | |
g = 7 | |
b = 75 | |
elif c == '3': | |
r = 182 | |
g = 62 | |
b = 62 | |
elif c == '6': | |
b = 255 | |
elif c == '7': | |
r = 239 | |
g = 232 | |
b = 164 | |
elif c == '8': | |
r = 62 | |
g = 184 | |
b = 165 | |
UH.set_pixel(x,y,r,g,b) | |
UH.show() | |
while True: | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment