Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft Akkiesoft/miku.py

Created Nov 17, 2014
Embed
What would you like to do?
UNICORN HATでミクさんを出すやつ
#!/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
You can’t perform that action at this time.