Advertisement
Giuseppe

öäkjlbhvgcdtrzesuriojäklmnkbhjvg

Mar 12th, 2025
160
0
20 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2. from waveshare_epd import epd2in13_V3  # Importiere die passende Klasse für dein Display
  3. from PIL import Image, ImageDraw, ImageFont
  4.  
  5. # Initialisiere das E-Ink-Display
  6. def init_display():
  7.     try:
  8.         epd = epd2in13_V3.EPD()  # Verwende die passende Klasse für dein Display
  9.         epd.init()
  10.         epd.Clear(0xFF)  # Lösche das Display (weiß)
  11.         return epd
  12.     except Exception as e:
  13.         print(f"Fehler bei der Display-Initialisierung: {e}")
  14.         return None
  15.  
  16. # Hauptfunktion
  17. def main():
  18.     # Initialisiere das Display
  19.     epd = init_display()
  20.     if not epd:
  21.         return
  22.  
  23.     # Erstelle ein einfaches Bild mit Text
  24.     image = Image.new("1", (250, 122), 255)  # Weißer Hintergrund
  25.     draw = ImageDraw.Draw(image)
  26.     font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 20)
  27.     draw.text((10, 10), "Hallo Welt!", font=font, fill=0)
  28.  
  29.     # Zeige das Bild auf dem Display an
  30.     epd.display(epd.getbuffer(image))
  31.  
  32.     # Setze das Display in den Schlafmodus
  33.     epd.sleep()
  34.  
  35. if __name__ == "__main__":
  36.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement