from machine import Pin, SoftI2C
import ssd1306
i2c = SoftI2C(sda=Pin(21), scl=Pin(22))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
tree_sprite = [
" 1 ",
" 111 ",
" 11111 ",
" 1111111 ",
" 1 ",
" 111 ",
" 11111 ",
" 1111111 ",
" 1 ",
" 111 ",
" 11111 ",
" 1111111 ",
" 1 ",
" 1 ",
" 1 "
]
def draw_tree(x, y, scale):
for r, row in enumerate(tree_sprite):
for c, p in enumerate(row):
if p == "1":
display.fill_rect(
x + c * scale,
y + r * scale,
scale,
scale,
1
)
display.fill(0)
draw_tree(10, 0, 2)
display.show()