-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Hi,
I have a 2.7 inches epaper screen, from waveshare. I use the driver that comes from here: https://github.com/mcauser/micropython-waveshare-epaper/blob/master/epaper2in7.py
I use it like this (this is my main.py):
from machine import Pin, SPI
import time
import epaper2in7
import framebuf
import pics
# SPIV on ESP32
sck = Pin(18)
miso = Pin(19)
mosi = Pin(23)
dc = Pin(22)
cs = Pin(5)
rst = Pin(21)
busy = Pin(4)
# spi = SPI(2, baudrate=100000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)
spi = SPI(2, baudrate=1000000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)
print("We're in main")
w = 176
h = 264
x = 0
y = 0
e = epaper2in7.EPD(spi, cs, dc, rst, busy)
e.init()
print("Screen ready")
buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
black = 1
white = 0
fb.fill(white)
# fb.text("Hello World", 30, 0, white)
e.display_frame(buf)
fb.blit(pics.fb_thermometer, 10, 2)
fb.blit(pics.fb_humidity, 10, 62)
fb.blit(pics.fb_pressure, 10, 122)
fb.blit(pics.fb_light, 10, 182)
fb.text("23°C", 70, 20, black)
e.display_frame(buf)
print("Image printed")
while True:
passThis is just a test example but it's not hard to understand. I have 5 framebuffers: 4 are images (60x60 pixels), 1 is the "main" one. I blit the 4 images onto the main framebuffer. This works.
Now, I would like to display the temperature near the thermometer image. I managed to write some text next to the image, but the font is way too small. I know each character is 8x8 by default, but I'd need something like 20px in height, otherwise the temperature isn't readable.
I would like to know if I can use the Writer class to do that. My device isn't a subclass of framebuffer ), so I was wondering what's the way to go here. Is it possible to simply write the text to a framebuffer, and blit it too on the main framebuffer?
Cheers