===== Arduino - OLED-Display mit Python =====
Ein sehr günstiges OLED-Display mit I2C-Interface gibt es für ca. 2€ bei https://www.ebay.de/itm/Blue-White-IIC-0-91-128x32-OLED-LCD-Display-3-3v-5v-f%C3%BCr-AVR-PIC-Arduino-Uno-R3/272476018178?ssPageName=STRK%3AMEBIDX%3AIT&var=571510694353&_trksid=p2057872.m2749.l2649
{{ :oled-small-raspi.png?400 |}}
Der Anschluss ist mit GND, 3.3V, SCL und SDA simpel. Mein Display hatte die Adresse 60 (0x3C), diese muss ggf. mit einem Arduinoprogramm ermittel werden (I2Cscan). Es wird die Bibliothek ''Adafruit_SSD1306'' benötigt, die mit
sudo pip install Adafruit-SSD1306
installiert wird.
**Programm:**
import Adafruit_SSD1306
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import time
font = ImageFont.load_default()
# Display 128x32 display with hardware I2C:
RST = None
disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST, i2c_address=0x3C)
disp.begin()
disp.clear()
disp.display()
# Create blank image for drawing (mode 1 for 1-bit color).
width = disp.width
height = disp.height
image = Image.new('1', (width, height))
# Get drawing object to draw on image.
draw = ImageDraw.Draw(image)
padding = 2
shape_width = 20
top = padding
# Write two lines of text.
draw.text((1, 2), 'Hello', font=font, fill=255)
draw.text((1, 20), time.strftime("%a %d %b %H:%M") font=font, fill=255)
# Display image.
disp.image(image)
disp.display()
Quelle: https://github.com/adafruit/Adafruit_Python_SSD1306