Skip to content

Instantly share code, notes, and snippets.

@mymindwentblvnk
Created February 3, 2023 22:31
Show Gist options
  • Save mymindwentblvnk/935bfe163d197eab5d311df407830655 to your computer and use it in GitHub Desktop.
Save mymindwentblvnk/935bfe163d197eab5d311df407830655 to your computer and use it in GitHub Desktop.
from enum import Enum
from sense_hat import SenseHat
import time
s = SenseHat()
class Color(Enum):
BLANK = (0, 0, 0)
RED = (255, 0, 0)
class Screen(object):
O = Color.BLANK.value
blank_screen = [
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
O, O, O, O, O, O, O, O,
]
def get_next(self, n):
c = list(self.blank_screen)
c[n-1] = Color.RED.value
return c
screen = Screen()
images = [
screen.get_next(1),
screen.get_next(2),
screen.get_next(3),
screen.get_next(4),
screen.get_next(5),
screen.get_next(6),
screen.get_next(7),
]
count = 0
if __name__ == '__main__':
while True:
s.set_pixels(images[count % len(images)])
time.sleep(4.0/7.0)
if (count % 7) == 6:
s.set_rotation((s.rotation + 90) % 360)
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment