Hi guys,
I connected my Uno to a 1602 16x2 LCD. I seem to be able to control it fine using the LiquidCrystal library. However, I decided that I wanted to leave the PWM digital pins free and switched to using a different signal pin assignment instead. I used the wiring in here with some modifications:
http://arduino.cc/en/Tutorial/LiquidCrystalModifications:
No pot -- Pin 3 is connected to ground instead of a pot
Pin 15 to +5V and Pin 16 to ground
Pins 2, 4, 7, 8, 12, 13 instead of Pins 2, 3, 4, 5, 11, 12, respectively
I also connect (Digital Pin 3, Ground) to an LED. With the LED connected, the following code produces garbled output on the LCD. If I disconnect the LED, comment out the lines outputting to Digital Pin 3, or output 0 or 255 instead of 127, the output is fine. I would like to understand why this is happening. It seems that outputting to Pin 3 is somehow affecting the other pins that control the LCD. In this case, 'garbled' means the screen is filled with 'S' and '5' characters and constantly flickers on both the top and bottom lines as if being updated.
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 8, 7, 4, 2);
#define LED 3
void setup() {
pinMode(LED, OUTPUT);
lcd.begin(16, 2);
lcd.print("Hello, world!");
}
void loop() {
analogWrite(LED, 127);
lcd.setCursor(0, 1);
lcd.print(555);
}