I’m new to electronics and I got the SainSmart LCD keypad Arduino shield from Ebay. I’ve got an Arduino Mega 2560. I have been able to load the “ADC Key Testing” sketch from the seller, nichegeek but, I can’t seem to get any others to work, i.e., Autoscroll, Display, etc. from the example codes that come with the Arduino 1.0 software amp “GuessTheNumber” found elseware without getting a lot of error messages. I loaded “Hello World!” and it compiles amp loads fine according to the Arduino 1.0 but, the shield doesn’t respond or show the message. The LED on my Mega flashes, so I know that it sent. However, while looking the code over, I saw that the pins in the sketch are calling out : LCD RS pin to digital pin 12, LCD Enable pin to digital pin 11, LCD D4 pin to digital pin 5, LCD D5 pin to digital pin 4, LCD D6 pin to digital pin 3, LCD D7 pin to digital pin 2, LCD R/W pin to ground, 10K resistor: ends to +5V and ground, wiper to LCD VO pin (pin 3), which are different than what the docs (from SainSmart) say this uses. I tried to figure out the correct pins/locations but have had no luck. Hope you understand what I am talking about.
2 Answers
Check this answer where I explain about an identical board and a gotcha with connections that vary with other implementations. The sketch is based on the auto scrolling sketch you mention in your question, but updated for the exact board you own.
You will have to look at the schematic for your Arduino to figure out the correct pins. It's likely these pins are defined in the sketches, so then you will need to change the defines according to your pinout.
You will be looking for a header file containing stuff like:
#define LCD_RS Digital_Pin_12
#define LCD_E Digital_Pin_11
Change the Digital_Pin_x to whatever LCD_X is connected to on your Arduino, for instance if LCD_RS is connected to pin 5 then the above will be #define LCD_RS Digital_Pin_5
. I don't use Arduino so I don't know the exact naming conventions (Digital_pin_x is just a guess), but it's likely it will be something like this. If you post your code and Arduino schematic it should be simple to figure the exact changes required.