I have the 2.8” TFT LCD and I’ve got it connected to a QT PY. I would like to display a number on the display – from a temperature sensor but when the number changes and is displayed on the LCD it writes over the top of the number that was there previously and it ends up being a giant mess (you can see both numbers, one on top of the other).
The only way I’ve figured out how to get around this is to fill the screen with a solid colour to cover over the previous number and then printing the new number. This results in the number being “clean” but there is a visible “flash” when the LCD first fills the screen with the solid colour and then prints the number on top of that. Is there a better way of doing this?
Also, I'm using the Arduino IDE.
Cleanly displaying changing numbers (or text) on a LCD
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Tormad
- Posts: 8
- Joined: Tue Jul 12, 2022 1:23 pm
- adafruit2
- Posts: 22144
- Joined: Fri Mar 11, 2005 7:36 pm
Re: Cleanly displaying changing numbers (or text) on a LCD
hi, you can use the text Setcolor procedure to set the foreground and background. If you set the background as a color, it'll overwrite the previous text.
- Tormad
- Posts: 8
- Joined: Tue Jul 12, 2022 1:23 pm
Re: Cleanly displaying changing numbers (or text) on a LCD
Thank you for your reply! I didn't know about this so I read up on it and it looks like that method doesn't work with custom fonts which is my case. It looks like with custom fonts you need to draw a filled rectangle and then write the text but I tried that and it unfortunately causes the text to flash briefly when it changes.
- alphanumeric
- Posts: 633
- Joined: Sun Sep 07, 2014 7:06 pm
Re: Cleanly displaying changing numbers (or text) on a LCD
I'm doing similar things on SPI displays on Pi's and PICO's, in Python and Micro Python.
I clear the buffer, or fill it with black, color (0, 0, 0). Rewrite it with the new info and then display it. I refresh the whole screen.
I clear the buffer, or fill it with black, color (0, 0, 0). Rewrite it with the new info and then display it. I refresh the whole screen.
- adafruit2
- Posts: 22144
- Joined: Fri Mar 11, 2005 7:36 pm
Re: Cleanly displaying changing numbers (or text) on a LCD
FYI, circuit python, has a system called displayio, which handles all of this for you cleanly
Please be positive and constructive with your questions and comments.