from machine import Pin, SoftI2C
from ssd1306 import SSD1306_I2C
# Налаштування OLED дисплея
i2c = SoftI2C(scl=Pin(22), sda=Pin(21))
oled = SSD1306_I2C(128, 64, i2c)
# Вивід привітання
oled.fill(0)
oled.text("Hi!", 10, 10)
oled.text("I - Ihor!", 10, 25)
oled.show()
# Пауза перед малюванням візерунка
import time
time.sleep(2)
# Очистка екрану перед малюванням візерунка
oled.fill(0)
# Малюємо візерунок у клітинку
rows = 8
cols = 16
cell_size = 8
for i in range(rows):
for j in range(cols):
x = j * cell_size
y = i * cell_size
if (i + j) % 2 == 0:
oled.fill_rect(x, y, cell_size, cell_size, 1)
oled.show()
print("Візерунок виведено на OLED!")