Skip to content

Instantly share code, notes, and snippets.

@leachy14
Created May 23, 2022 19:22
Show Gist options
  • Save leachy14/940a5545b7d6e8af8f25fcfffe57e9ca to your computer and use it in GitHub Desktop.
Save leachy14/940a5545b7d6e8af8f25fcfffe57e9ca to your computer and use it in GitHub Desktop.
This simple script will generate random pixels on the raspberry pi senseHAT
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