Hi, do you have other digital IOs available in your project? You can use any other spare digital IOs to control the LCD. However, you will have to initialise your LCD "variable" differently to reflect your new mapping. Let us know if you have queries as to how to set it up.
If you don't have additional or spare IOs then you should look for an IO extender.
You probably followed the Arduino Liquid Crystal Tutorial at http://arduino.cc/en/Tutorial/LiquidCrystal when you started tinkering with your LCD module. That tutorial happens to use these Arduino pins:
* 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
And they are implemented with this code:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
If they had added an additional comment like this:
// initialize the library with the numbers of the interface pins
[color=red]// LiquidCrystal lcd(RS, E, D4, D5, D6, D7);[/color]
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
it would be a little clearer that you can use any available I/O pin, including the 'analog' pins, for any LCD line. All you have to do is make sure that the list in your LiquidCrystal lcd() statement matches the pins that you are using.
You could just attach the pins normally attached to pins 2-5 on the arduino to pins 4-7 and setup the program like this:
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
That will free both pin 2 and 3.
I hope this helps.
You could just attach the pins normally attached to pins 2-5 on the arduino to pins 4-7
I would recommend not using pins 4 or 7 for an LCD. It's a peculiarity with those two where they supply a voltage during the sketch start before the lcd is initialized. This causes the lcd to hang which prevents your program from running.