from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from time import sleep
# [수정됨] 핀 설정
i2c = I2C(1, scl=Pin(27), sda=Pin(26), freq=200000)
oled = SSD1306_I2C(128, 64, i2c)
count = 0
while True:
# 1. 화면 지우기 (검은색)
oled.fill(0)
# 2. 내용 작성
oled.text("Counting...", 0, 0)
# 숫자를 화면 중앙 쯤에 표시 (str로 변환 필요)
oled.text(str(count), 50, 30)
# 3. 화면 업데이트
oled.show()
count += 1
sleep(0.1) # 0.1초 대기