Skip to content

Instantly share code, notes, and snippets.

@amandaroos
Created September 20, 2020 06:23
Show Gist options
  • Save amandaroos/49a600e8f2f28efe285dca127ebae4ce to your computer and use it in GitHub Desktop.
Save amandaroos/49a600e8f2f28efe285dca127ebae4ce to your computer and use it in GitHub Desktop.
blue pacman ghost for Pi Sense hat LEDs
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.rotation = 90
L = [0,0,200] #Blue
D = [0,0,100] #Dark Blue
W = [100, 100, 100] # White
B = [0,0,0] #Black
ghost = [
B, B, L, L, L, D, B, B,
B, L, L, L, L, D, D, B,
L, L, W, B, L, W, B, D,
L, L, W, W, L, W, W, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, B, L, L, B, L, D, D
]
ghost2 = [
B, B, L, L, L, D, B, B,
B, L, L, L, L, D, D, B,
L, L, B, W, L, B, W, D,
L, L, W, W, L, W, W, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, B, L, L, B, L, D, D
]
ghost3 = [
B, B, L, L, L, D, B, B,
B, L, L, L, L, D, D, B,
L, L, W, W, L, W, W, D,
L, L, B, W, L, B, W, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, L, B, L, L, B, D, D
]
ghost4 = [
B, B, L, L, L, D, B, B,
B, L, L, L, L, D, D, B,
L, L, W, W, L, W, W, D,
L, L, W, B, L, W, B, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, L, L, L, L, L, D, D,
L, L, B, L, L, B, D, D
]
sense.low_light = True
ghosts = [ghost, ghost2, ghost3, ghost4]
pause = .20
loop = 10
while (loop > 0):
for x in ghosts:
sense.set_pixels(x)
time.sleep(pause)
for x in reversed(ghosts):
sense.set_pixels(x)
time.sleep(pause)
loop = loop -1
sense.clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment