Extending the LiquidCrystal library

When using the LiquidCrystal library to output some text on an LCD on my Arduino Uno, I stumbled upon the following problem: if a text is displayed on the screen (let’s say “hello world!”) and you try to display another text (let’s say “bye”) you end up with the following text: “byelo world!”.

The reason for this is that the screen doesn’t clear a line before writing to it.

I could easily solve the problem in my code (just print spaces for all remaining characters) but I thought it would be more convenient if I built the capability directly into the Library. I added a function printLine(int line, const String text) which solves this task.

Download LiquidCrystalExt. To install you just have to unzip and copy it into the folder library either of the Arduino IDE or of your sketchbook.

Example: