from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
# OLED EINRICHTEN: I2C-Controller auswählen, oled-Objekt erzeugen.
# I2C-Controller am ESP32: I2C(0, sda=Pin(21), scl=Pin(22)) | I2C(1, sda=Pin(18), scl=Pin(19))
# I2C-Controller am Arduino Nano ESP32: I2C(0, sda=Pin(11), scl=Pin(12)) | I2C(1, sda=Pin(13), scl=Pin(14))
i2c = I2C(0, sda=Pin(21), scl=Pin(22)) # I2C-Controller 0 hat diese Pins. # alternativ Software I2C verwenden: i2c = SoftI2C(sda=Pin(21), scl=Pin(22))
oled = SSD1306_I2C(128, 64, i2c)
'''
# weiße Pixel anzeigen:
n=0
while n < 128:
oled.pixel(n,10,1) # x-Koordinate (links = 0), y-Koordinate (oben = 0), 1: weiß
oled.show()
n=n+1
'''
lady = [
[0,1,1,1,0],
[0,1,1,1,0],
[0,0,1,0,0],
[1,1,1,1,1],
[0,0,1,0,0],
[0,1,1,1,0],
[1,1,1,1,1]
]
man = [
[0,1,1,1,0],
[0,1,1,1,0],
[0,0,1,0,0],
[1,1,1,1,1],
[0,0,1,0,0],
[0,0,1,0,0],
[0,1,0,1,0]
]
oled.eigeneFigur(0, 0, lady, scale=2) # (x-, y-Position obere linke Ecke, figurName, Maßstab)
oled.eigeneFigur(10, 0, man, scale=2) # (x-, y-Position obere linke Ecke, figurName, Maßstab)