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:

ElecFreaks JoyStick Game Kit

There is a Tutorial how to prepare it. In the tutorial there is a link to a library which can be used for the Nokia 5110 LCD display. However for me it did not work. I tried to run the code in the Arduino IDE (v. 1.0.1). It didn’t compile.

Fix the broken library

The reason was that it didn’t find the wProgramm.h Header and it lacked the Arduino.h header. I prepared a version of it which works. If you are running linux you can save it (the contained folder) into /home/yourusername/sketchbook/libraries/. Now in the Arduino IDE you should have an entry NokiaLCD5110 under Sketch/Import Library/.

Upload the programm to the Freeduino v1.2

The kit I bought included a Freeduino v1.2. It is 100% compatible to an Arduino but it cannot be programmed if you chose the Arduino Uno board. You need to change it to Arduino Nano w/ ATmega328 under Tools/Board.