from machine import Pin, I2C
import ssd1306
from time import sleep_ms
# ESP32 Pin assignment
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
oled.text('ElectroHakemi', 2, 2)
oled.show()
sleep_ms(2000)
def oledPrintLetterByLetter(text : str, x : int = 2, y : int = 2, each_delay : int = 100) -> None:
xFirst = x
for ch in text:
if ch == '\n':
x = xFirst
y = y + 10
continue
sleep_ms(each_delay)
oled.text(ch, x, y)
oled.show()
x = x + 8
while True:
sleep_ms(1000)
oled.fill(0)
oled.show()
oledPrintLetterByLetter('Electro\nHakemi')