Skip to content

Instantly share code, notes, and snippets.

@foresmac
Last active March 1, 2016 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foresmac/b5e6e644498924c465be to your computer and use it in GitHub Desktop.
Save foresmac/b5e6e644498924c465be to your computer and use it in GitHub Desktop.
from sense_hat import SenseHat
import random
import time
hat = SenseHat()
o = (200, 128, 0)
r = (255, 0, 0)
y = (255, 255, 0)
b = (0, 0, 0)
pattern = [
'l', 'l', 'l', 'l', 'l', 'l', 'l', 'l',
'l', 'l', 'l', 'l', 'l', 'l', 'l', 'l',
'l', 'b', 'b', 'l', 'l', 'b', 'b', 'l',
'l', 'b', 'b', 'l', 'l', 'b', 'b', 'l',
'l', 'l', 'l', 'b', 'b', 'l', 'l', 'l',
'l', 'l', 'b', 'b', 'b', 'b', 'l', 'l',
'l', 'l', 'b', 'b', 'b', 'b', 'l', 'l',
'l', 'l', 'b', 'l', 'l', 'b', 'l', 'l',
]
while True:
image = [random.choice([o,r,y]) if p == 'l' else b for p in pattern]
hat.set_pixels(image)
time.sleep(1/4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment