Please help me, I need to make a running line on lcd.
Looks like a metro
I donât see any existing libraries to handle this, but you can use gweimer/utils/sub-string to pull the part of string to display, then keep incrementing OFST to âscrollâ through the text.
Youâll probably want to use âcountâ node that gets incremented by âclockâ node to feed OFST. Youâll need additional code to reset count when you reach the end of the string. You could add additional code to handle loop scrolling instead of jumping to start of message when end of message is reached, but it would be easier just to add a copy of the 1st part of the message to the end of message. For example, if your display is 16 characters, you probably want a couple spaces at the end of the message, then repeat the 1st 15 characters of the message; now when it âjumpsâ at the end of message back to beginning of message, it will be a smooth scroll to show the 1st 16 characters. You can even automate this by storing the message to display, but using âconcatâ node with storage + spaces + sub-string of storage to feed sub-string node that feeds lcd.
Thereâs probably a way to get length of string, but Iâm supposed to be working now, so I just hard-coded the length of 39 in this example (36+3 spaces from middle concat input).
The num⌠node is number-to-i8 because sub-string uses bytes. The green nodes at the top are tweak-string & tweak-number nodes to allow changes. The green node at the bottom is a watch node to replace lcd to allow simulation. Code assume LCD will be 16-characters wide.
I added a string-length node to gweimer/utils
Since there are no checks for messages < 16 characters, weird things will happen for short messages.
Boy this got ugly fast. This adds tweak-number for length of LCD screen (16), and checks if string is short enough that it doesnât need scrolling.
If it is a short string, just display it and disable clock so we donât scroll.
If it is a long string, concat extra characters, and enable clock to scroll.
Reset count if we reach end of string or if string changes (pulse-on-change).
The single-block vertical wires are âjumperâ nodes to route wires around other nodes.
Iâve added some additional options & published it as gweimer/utils/text-scroll with an example node showing its usage.