Toggle Navigation
Hatchery
Eggs
Anyfish
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
""" AnyFish Modified lilafisch POV for Card10 Allows to use any image converted by https://www.dcode.fr/binary-image Usage: Paste the output from your conversion to IMAGE-variable. author: Heikki Juva """ import leds import htmlcolor import utime DELAY = 0.01 # time in seconds LILA = htmlcolor.BLUEVIOLET IMAGE = """ 00011111000 00100000100 01011011010 10100000101 10100000101 10000000001 10000000001 10010011001 01000000010 00100000100 00011111000 """ converted_image = [] split_image = IMAGE.split("\n") try: for row in split_image: if len(row) == 0: continue assert len(row) == 11 converted_row = [] for char in row: if char == '1': converted_row.append(1) else: converted_row.append(0) converted_image.append(converted_row) except AssertionError: print("Error reading image data") print(len(converted_image)) print(len(converted_image[0])) print(converted_image) fish_line = 0 while True: print(converted_image[fish_line]) for position, on in enumerate(converted_image[fish_line]): if on or on == '1': leds.prep(position, LILA) else: leds.prep(position, htmlcolor.BLACK) leds.update() utime.sleep(DELAY) fish_line = (fish_line + 1)%11