microbit Paparazzi Simulator

Another small bit of code, similar to blinkenlights, that turns on a random pixel then lets it fade out before turning on the next one. The effect is a bit like a lethargic swarm of fireflies or being at a photo call in front of a bunch of very polite, respectful paparazzi :)


from microbit import *
import random

fade_interval = 100

while True:
    x = random.randint(0, 4)
    y = random.randint(0, 4)
    
    intensity = 9
    
    while intensity >= 0:
        display.set_pixel(x, y, intensity)
        intensity -= 1
        sleep(fade_interval)