So this week after completing the Arduino Starter Kit, Project 11: Crystal Ball with my Interactive Digital Media class, I was intrigued by the LCD screen and wondered how to create scrolling text. While the Liquid Crystal Library clearly documents the scrollDisplayLeft() function, this scrolls both lines simultaneously. So this got me thinking, can I make only one line scroll?
After a lot of web searching in various Arduino forums and finding many people asking this question only to get ‘this can’t be done’ as an answer I eventually stumbled upon this post by Nishant Arora where he uses the subString() method to scroll a single line. Now I just needed content for the LCD display.
I am not sure why, but the viral video The Fox (What Does The Fox Say?) by Ylvis kinda popped into my head so I looked up the lyrics and used them for my sketch.
Now my idea is coming together. Loop back and forth between “What does the fox say?” and “The fox says (insert random response).” A little tweaking of Nishant’s code to flop the scrolling line to line two, update the switch function with my new fox sayings, and put the switch into its own function so that it could be reused easily.
I also found that tinkercad.com now allows circuit design, so I started building my circuit there and writing my code in order to speed up the testing phase without needing to compile and upload every time to check to see if it works. Here is a public link.
Once I had the code working, I put it into the Arduino IDE and only had to play with the delay times to get the speed I wanted. Here is a video of the final
[codepen_embed height=”600″ theme_id=”0″ slug_hash=”rzjxBP” default_tab=”js” user=”findes”]See the Pen Arduino – Scrolling LCD Text by Troy Finamore (@findes) on CodePen.[/codepen_embed]