how can I scroll part of text on lcd screen ?

Hello every body. :slight_smile:

On my lcd screen I want display one line whith date like "Wednesday March 09 2078 12:34:56".

How can I scroll up each element only when changed ?

Saturday March 28 2020 12:34:56 each second of course
Saturday March 28 2020 12:34:56 each time unit seconds turn to 0
Saturday March 28 2020 12:34:56 each time the ten seconds turn to 0
Saturday March 28 2020 12:34:56 each time the unit minutes turn to 0

and so on for name of day, name of month, date, month, year, hour...

How can I scroll left all the line whith date, keeping inside scroll up each element ?

Each scroll is 1 pixel step and speed is 2 characters / seconde.

I my mind I think I need made an object line having scroll left property containing 12 same object rectangle with scroll up property.
But my problem is create structure. I learn it but never understand really.
I can understand existing structure and use or modify it.


Actually I wrote something very bad, without name of day and name of month, without scrolling.

mydate is 03-09-2078 12:34:56

I have an array with 12 arrays with 6 values.
Values are, top left, top hight, width, height of a rectangle and last and new number.

Arrays are for each number in date except 20, I do not change century.

Each second, I "explode" date string in 11 elements, if new number is same old number I do nothing, else I draw a filled rectangle, I print new number, I replace old number by new number.

mydate in arrays is "inverted" 653421900978, I test change left to right, I not change I stop test.

Sorry for my poor english.
Agostino

I am not sure what you really want.

If you want to move individual digits like a mechanical odometer on an "older" motor car:

Draw all the digits in a vertical bitmap e.g.

0
1
2
3
4
5
6
7
8
9
0

Then you just use drawBitmap() to select a square window from the rectangular bitmap.

The same arrangement can be done with the weekday, month.

Please post a link to the actual screen you have bought e.g. Ebay sale page.
Please say which library you are using. Some will let you read the screen memory.

Or say what font and size you want to use.

Don't worry about poor English. Write your question in your own language. Then ask Google Translate to convert to English.

David.

Thank you for your answer.

I use TFT_eSPI.h for TTGO T-Display

ESPRESSIF-ESP32 240 MHz Xtensa® single- / dual-core LX6 32-bit microprocessor chipset
FLASH QSPI flash 4 MB
SRAM 520 kB SRAM
USB to TTL CP2104
Display IPS ST7789V 1.14 Inch

More information: [GitHub - Xinyuan-LilyGO/TTGO-T-Display](http://More information: GitHub - Xinyuan-LilyGO/TTGO-T-Display)

Now I use default font with size 4, 6, 8 but it is variable, W or 8 have not same width than i or 1. Can you purpose a nice font with same width for all letter ?

Maybe you can find something whith font monospaced (uniform stroke) and font proportional (modulated stroke)

Yes, I want nice monospaced (uniform stroke) font, with same width for all letter, where W or 8 have not same width than i or 1.

ESP32 work like arduino, it use same libraries (exept display) and screen have same function.

How can I change only new number without blinking screen each second ?

black_hole:
How can I change only new number without blinking screen each second ?

If you do not want to blink the screen, then do not blink it!

Do not clear or re-write the entire screen. Locate where you need to make the change, and re-write the character(s) you need to change there, and nowhere else.

It's just common sense.

Here is an example that should work on your TFT_eSPI.

You can create your own bitmaps if your screen is readable. I have only tested with SPI ILI9341.

Quite honestly it seems pointless for a small font. Looks nice with a big font.
How often do you sit and watch the Arduino at 23:59:59 on Dec 31 ?

David.

write_bitmap8.zip (2.85 KB)

Paul__B:
Do not clear or re-write the entire screen. Locate where you need to make the change, and re-write the character(s) you need to change there, and nowhere else.

Obviously! is that I already do

black_hole:
Each second, I "explode" date string in 11 elements, if new number is same old number I do nothing, else I draw a filled rectangle, I print new number, I replace old number by new number.

But propotional have not same width and it is not easy to define where I need rewrite.

david_prentice:
Here is an example that should work on your TFT_eSPI.

You can create your own bitmaps if your screen is readable. I have only tested with SPI ILI9341.

Quite honestly it seems pointless for a small font. Looks nice with a big font.
How often do you sit and watch the Arduino at 23:59:59 on Dec 31 ?

David.

Thank you very much, I will try it this week-end.
Every year I watch the clock at 23:59:59 on Dec 31 = happy new year !

I do not watch the clock each day à 23:59:59, and if blinkink to change day-name, day-date, and sometime month-name or year, it is not important.

More comments after testing your sketch, maybe you give me the soltution.

I watched my kitchen clock change for SummerTime (BST / GMT) once.

It is cool to see the hands move automagically on a radio-controlled clock. However I intend to be in bed when the clocks change.

David.

1 Like

My NTPclock is ok for summertime, I test UTC each time before print.
Now my NTPclock ask web each 5' (300,000 ms) and I will change it for 15', if I find where.

Radio control DCF77 for arduino is expensive, I think use GPS.

I take a look to your sketch. It is great. Thank you.

I need to understand how works tft.drawBipmaps().

To translate your bipmaps.h I try create myBipmaps.h, on screen it is good but serial show only 0x00.
Later I try bigger font and play with color.

const uint8_t PROGMEM digits[] = {
0x00, 0x00,
.../...
0x00, 0x00
};
const uint8_t PROGMEM weekdays[] = {
0x00, 0x00, 0x00, 0x00, 0x00,
.../...
0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t PROGMEM months[] = {
0x00, 0x00, 0x00, 0x00, 0x00,
.../...
0x00, 0x00, 0x00, 0x00, 0x00,
};

After this, I add ":" between hour minute second and spaces in date.

I suspect that your screen is write-only. Hence readPixel() is returning 0x00
I do not have your screen

If you own a Red ILI9341 SPI display Bodmer's TFT_eSPI library can read the controller.
Or run the program on a Uno with Mcufriend display.

Or just post the commands to draw the picture, text, graphic that you want to "read".
And someone might generate the bitmap array for you.

David.

I other example.ino for for TTGO T-Display I have
TFT_eSPI tft = TFT_eSPI(135, 240);
but nohing after change your sketch.

Now I have not any arduino.

Maybe you can help me to use external font ?
https://forum.arduino.cc/index.php?topic=674110.msg4537302#msg4537302

https://forum.arduino.cc/index.php?topic=418598.msg2900357#msg2900357

Thank you for your link, but I have not
tft.setFont();
I try to create it on sunday from MCUFRIEND_kbv

Either quote a font by name or post a photo.

I suspect that your display is 240x320 or 160x320. In which case you can only use small fonts if you want to fit Saturday March 28 2020 12:34:56 on the screen.

Saturday December 31 2020 12:34:56 would need even more space. 54 letters on a 320 wide screen means 6 pixels per letter. e.g. 7x5 font instead of the 14x10 font from my example.

Quite honestly, most 7x5 fonts look the same.

David.

black_hole:
I other example.ino for for TTGO T-Display I have
TFT_eSPI tft = TFT_eSPI(135, 240);
but nohing after change your sketch.

Exactly I want create 2 lines (65 x 240) :

  • first with hour : minute : seconde , working same as your sketch (scroll up)
  • second with "Saturday 31 December sat 31 Dec 20" (as ring scrolling to left)

It is toochscreen, first click show hh:mm full screen, second click show mm:ss full screen, next click return 2 lines display.

Because I want understand what I do, I do not ask this in my first post, wanted do it myself (with your help to start).

HH:MM:SS is 8 characters. If your screen is 65 wide x 240 high, you can only have 10 pixels per digit width and 2 pixels for the colon.

If your screen is Landscape e.g. 240x65, you can have bigger digits e.g. 30 pixels per digit width.
I have shown you how to scroll up individual digits.

Weekday, Month DD, YYYY needs small font. You can use regular print statements. Just change print position with setCursor()

Post what you have done so far. If you want a new "bitmaps.h" file, say which font and what size. I will post a new "bitmaps.h"

David.

Looking at the User_Setup.h file for TFT_eSPI you could try enabling this line to make readPixel() work.

// #define TFT_SDA_READ      // This option is for ESP32 ONLY, tested with ST7789 display only

e.g. edit the Setup25_TTGO_T_Display.h file

#define ST7789_DRIVER
#define TFT_SDA_READ      // This option is for ESP32 ONLY, tested with ST7789 display only

#define TFT_WIDTH  135
#define TFT_HEIGHT 240

I see that your display is 135x240. So that would be much bigger than 65x240

If readPixel() works you can develop the whole project by yourself.

David.

Thank you very much for the time and research you are doing.

I modify the User_Setup.h file for TFT_eSPI and the Setup25_TTGO_T_Display.h file, it's work fine now.
I modify your sketch and adding an array "spaces" with ("-" " " "/" ":" ) to separate words and numbers.

I haven't written anything yet, but for the moment I'm asking myself questions and I can't find a solution.

To scroll a text in a line over the entire length of the screen from right to left, I can do it by replacing the first by second character ans so on, but it jumps instead of sliding.

With setCursor, I can do it pixel by pixel, but I think I need 2 more characters (i less than w) which would be "displayed" on the right outside the screen.
Is it an intern memory problem ?