from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import time
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
oled = SSD1306_I2C(128, 64, i2c)
oled.text("Raspberry Pi", 16, 25)
oled.show()
time.sleep(1)
oled.fill(0)
oled.show()
x = 0
def draw_heart(x, y):
heart = [
[0, 1, 1, 0, 0, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 1, 1, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0]
]
for dy in range(8):
for dx in range(8):
if heart[dy][dx]:
oled.fb.pixel(x + dx, y + dy, 1)
while True:
oled.fill(0)
draw_heart(60, 25)
oled.show()