This commit is contained in:
Benjamin Tayehanpour 2026-09-30 20:46:34 +00:00
parent edcf0ef8b1
commit b40e11af76

80
animation.py Normal file
View file

@ -0,0 +1,80 @@
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)