Created
May 23, 2022 19:22
-
-
Save leachy14/940a5545b7d6e8af8f25fcfffe57e9ca to your computer and use it in GitHub Desktop.
This simple script will generate random pixels on the raspberry pi senseHAT
This file contains 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
from sense_hat import SenseHat | |
from random import randint | |
from time import sleep | |
sense = SenseHat() # define the sensehat | |
while True: | |
sense.low_light = True | |
x = randint(0,7) # X coordinate of pixel | |
y = randint(0,7) # Y coordinate of pixel | |
r = randint(0,255) | |
g = randint(0,255) | |
b = randint(0,255) | |
sense.set_pixel(x, y, r, g, b) | |
sleep(0.1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment