import machine
import time
import epaper2in9
from machine import Pin, SPI
import image_dark
# interpreter versions
# micropython-20220618-v1.19.1
# micropython-20231227-v1.22.0
# Pin definitions (adjust to match your wiring!)
CS_PIN = 5
DC_PIN = 4
RST_PIN = 2
BUSY_PIN = 15
# SPI Configuration
spi = SPI(1, baudrate=100000, sck=Pin(18), mosi=Pin(23))
# Initialize the e-paper display
cs = Pin(CS_PIN, Pin.OUT)
dc = Pin(DC_PIN, Pin.OUT)
rst = Pin(RST_PIN, Pin.OUT)
busy = Pin(BUSY_PIN, Pin.IN)
epd = epaper2in9.EPD(spi, cs, dc, rst, busy)
epd.init()
print("E-Paper display initialized")
w = 128
h = 296
x = 0
y = 0
image=image_dark.hello_world_dark
# Clear the display to white
#epd.clear_frame_memory(0xFF)
#epd.clear_frame_memory(b'\xFF')
epd.set_frame_memory(image, x, y, w, h)
epd.display_frame()
print("E-Paper display cleared to white!")
time.sleep(1)
# Clear the display to white
#epd.clear_frame_memory(0x00)
#epd.display_frame()
#print("E-Paper display initialized and cleared to black")Loading
epaper-2in9
epaper-2in9