In terms of your core original question, as to which library can be used to drive the LCD.
The LiquidCrystal library that comes with the IDE since about IDE 0016 or so will work.
The issue you will have is that all the examples that come with the LiquidCrystal library use
a different pin wiring to the LCD than the shield you have. That is why you can't simply
use any of the examples. They do work, they just won't work "as is" with your LCD-keypad shield
since the internal wiring on the PCB of the shield hooks up different Arduino pins to the LCD than
what the examples are configuring the LiquidCrystal library to use.
You can either go directly modify the LCD constructor in the LiquidCrystal library examples directory
to use the pins for your shield pins or make copies of them and modify the copies.
The "libraries" directory referred to is underneath where ever you installed the Arduino s/w.
i.e. in this case the examples are located:
The IDE wants to see the directory name and sketch name in the examples directory match.
So if you make copies under an existing directory, you need to make sure the directory and sketch match.
You also must exit and re-start the IDE every time you create a new directory with a sketch.
You can also put them in your private sketch area which also can have a "libraries" area.
Simply copy examples from the LiquidCrystal library area and put them in your private
sketch are and leave the originals alone.
This is a better approach as your private area will continue to show up for future
IDE installs vs just being in the release you happen to modify/update.
To locate your private sketch area location, bring up the IDE and click on
It is there in the Sketchbook location box.
What I do to make it simpler and more obvious and to plan for the future,
is to go to that location and create 3 sub-directories:
is used for alternate cores like attiny, 644/1284 etc... ( you might not ever use this)libraries
- can be used for 3rd party libraries that you may like and collect over time say:
IRremote, temperature, OneWire, RTC, etc...
- well that is where you create directories for your sketches.
The nice thing about using this structure is that you only have to set it up once
and then it will show up on all future IDEs.
To use the sketches, from your private area in the IDE simply click on
Then you can click on "libraries" or "sketch" then drill down to pick the desired
Hope that helps.
BTW, take note of the backlight control issue in the thread mentioned
at the bottom of this reply.
Some of newer LCD shields have fixed this issue but many have not so
it is worth a read to understand the potential issue.
I don't have a sainsmart shield, just one that looks the same, as I made very clear, and it came with no documentation.
As I also surely made very clear, I determined the pin assignment by reading the back of the circuit board, hence the comprehensive list in my reply #1, and the two configuration lines compared. I would have thought that was reasoning solid enough on which to base my comment. You may find that reasoning not solid enough, but I'm not sure I want hear about that.
So you are saying that your LCD-keypad shield is not the same as the sainsmart LCD-keypad
shield in that the R/W line is wired to Arduino pin 13 (the Arduino LED) on your shield?
It's possible, (I've seen some crazy things out there in Arduino land)
but so far I've not seen an LCD-keypad shield that has done this. All the ones I've seen, including the SainSmart,
YwROBOT, LinkSprite, DFRrobot, Emartee, and many other LCD-keypad shields, hardwire the LCD R/W pin to gnd
so they do not waste and Arduino pin. This is a good design decision
since the Arduino supplied LiquidCrystal library does not use BUSY polling and
sets R/W pin (if specified) to ground anyway.
Many of the LCD-keypad shield designs seem to have copied one another all the way down to a hardware
design issue with respect to controlling the LCD backlight - on the boards that allow backlight control.
See this thread for issues related to that issue:http://arduino.cc/forum/index.php/topic,96747.0.html
With respect to backlight control. I would encourage anyone using the shields backlight control
capability to be very careful using it (i.e. don't use it) until you know if the shield has
a proper backlight circuit.
Many of the lcd shields out there have a bad circuit and are overloading the pin
being used for backlight control when controlling it using simple digitalWrite() functions
or analogWrite() for dimming.