import asyncio # animated tile set # fan, four frames FAN = [ [0b00000, 0b00100, 0b00100, 0b11111, 0b00100, 0b00100, 0b00000, 0b00000], [0b00000, 0b00010, 0b11010, 0b00100, 0b01011, 0b01000, 0b00000, 0b00000], [0b00000, 0b10001, 0b01010, 0b00100, 0b01010, 0b10001, 0b00000, 0b00000], [0b00000, 0b01000, 0b01011, 0b00100, 0b11010, 0b00010, 0b00000, 0b00000] ] # wind, three frames WIND = [ [0b01101, 0b10010, 0b00000, 0b01101, 0b10010, 0b00000, 0b01101, 0b10010], [0b10110, 0b01001, 0b00000, 0b10110, 0b01001, 0b00000, 0b10110, 0b01001], [0b11011, 0b00100, 0b00000, 0b11011, 0b00100, 0b00000, 0b11011, 0b00100] ] class animator: def __init__(self, lcd, slot, slides, delay): self.lcd = lcd self.slot = slot self.slides = slides self.delay = delay async def start(): for slide in self.slides: lcd.set_chat(self.slot, self.slide) await asyncio.sleep(self.delay)