def win(): icon = [(0, 3), (1, 2), (1, 4), (2, 1), (2, 5), (3, 0), (3, 1), (3, 2), (3, 6), (4, 0), (4, 1), (4, 2), (4, 6), (5, 1), (5, 5), (6, 2), (6, 4), (7, 3)] def draw(x, y, b): set_pixel((x + shift) % 17, y, b) shift = 0 while True: for x, y in icon: draw(x, y, 0) shift = 0 if shift == 16 else shift + 1 for x, y in icon: draw(x, y, 200) show() sleep(100)
# generates a barcode pattern on the scroll:bit that redraws randomly # ensure scrollbit.py is copied onto your micro:bit to avoid import errors import scrollbit import random import time # you can add another stripe variant here if you like. stripes = [0, 50, 255] # chose c for column and r for row but you could use x and y while True: for c in range (0, 17): brightness = random.choice(stripes) for r in range(0, 7): scrollbit.set_pixel(c, r, brightness) scrollbit.show() time.sleep(0.1) scrollbit.clear()