LCD / string question

Hello, I'm trying to display a tweet on a 16x2 LCD display. On the top line I have the tweeter's name and time. On the second line I want the tweet scrolling along. A tweet can be up to 140 characters - if I send this to the LCD it overflows back on to the top line.

How do I stop this?

For a bit more detail, I'm grabbing data over ethernet, using the PString library to collect the tweet details into strings then outputting those to the LCD.

Thanks, CowJam

You need to write code to "scroll" the text. If you want to "scroll" "Hello world!", you would send to the LCD:

Hello world! ello world! H lo world! Hel o world! Hell world! Hello orld! Hello w rld! Hello wo ld! Hello wor

Each line needs to be preceded by a set cursor command to position the cursor at the beginning on the 2nd line. Each string sent to the LCD would contain no more than 16 characters, to prevent wrapping back to line 1.

Thanks PaulS. I was hoping there'd be a "don't overflow" command to make it easy!

I was hoping there'd be a "don't overflow" command to make it easy!

There will be, when you're done.

If the LCD is compatible with the Hitachi HD44780 controller then you can use the LiquidCrystal Library which has a scroll function. Then whatever it is that needs to be display will automatically scroll. Problem is there is character limit. If i remember right it will only hold 20 characters. So the message will have to be broken up into 20 character segments and displayed one at a time giving time to allow the message to scroll through once.

http://arduino.cc/en/Tutorial/LiquidCrystalScroll

Thanks digimike. I've been using the LCD library, the problem being overflow.

I've written a routine which takes a 16 character chunk of a string and displays it. Where it takes that chunk from depends on an offset which is incremented each recursion - giving the effect of scrolling.