DOT3k - Scrolling Text without Menu


#1

Hey guys - I’m trying to scroll text with some code I found and adapted, what I’m trying to create is a single screen with :

line 1 - Time (working OK)
line 2 - WiFi strength (working OK)
line 3 - Weather (OK if its under 16 characters)

So I wanted line 3 to scroll using -

def scrollText( scrollBlurb ):
if len(scrollBlurb) > 16:
padding = " " * 16
oldText = scrollBlurb
scrollBlurb = padding + scrollBlurb + " "
for i in range (0, len(scrollBlurb)):
lcd.write(scrollBlurb[i:(i+16)])
time.sleep(0.35)
lcd.write(oldText[:16])
else:
lcd.write(scrollBlurb)

Calling it with

scrollText("current weather will be here and can be over 16 chars … ")

No matter what I do it fills all three lines of the display with scrolling text. Is there any option to scroll text without using the menu option as I’m lost with the menu option and importing plugins …

many Thanks


#2

Looks like you need to use lcd.set_cursor_position(0,2) to return the cursor back to the beginning of the third line before each call to lcd.write() for your scrolling text.

You’ll probably want to lcd.set_cursor_position(0,X) for each row, where X is the row.

Don’t ask why it’s columns/rows… I must have had a serious brain hiccup at some point in the process of writing the library.


#3

Yep thats fixed it, I’d missed that option … I must try and learn how to build menus and use the auto advance hack you posted recently …


#4

I’m planning to try and put together a less hacky version of that, but I haven’t quite fleshed out the details yet.


#5

Yeah I’d find that useful, as one of my Pis will remain headless and cased so I will never use the joystick (keeps office fingers away!!) - It’s just going to be used to give ‘information’ as the screens change on my desk …