Parallax Serial LCD Backlight

I bought a 2x16 Serial Parallax LCD display. It works fine and plays sound and the backlight turns on and off when I want it to. I started having problems though when I hooked up a pot to A3 and tried to display the value on the LCD. It displays the value, but when I turn it, the backlight suddenly turns off, but the value is still displayed. What can I do to get it to work? My 2560 is R3.

int sens = 0;

void setup() {  
  // Initialize serial port 1:
  Serial1.begin(9600);
  delay(100);
  // Clear and turn backlight on:
  Serial1.write(12);
  Serial1.write(17);
  delay(5); // Required Delay
  Serial1.write("Testing LCD");
  Serial1.write(13);
  Serial1.write("5 Seconds");
  delay(5000);
}

void loop() {
  // Read Pot
  sens = analogRead(A3);
  // Send text to the LCD:
  Serial1.write(12);
  Serial1.write(17);
  delay(5);
  Serial1.print(sens);
  delay(100);
}

Dante12129: I started having problems though when I hooked up a pot to A3 and tried to display the value on the LCD. It displays the value, but when I turn it, the backlight suddenly turns off, but the value is still displayed. What can I do to get it to work?

What value pot? Does all that mean that there is a range in the pot travel where the backlight is good, but that when you get to one extreme or the other it konks out?

It is 10k. It's usually when I get around the lower extremes but sometimes occurs when I turn it very slightly to a lower value.

Try adding a low value (10-100?) resistor between the pot and +5 (or Ground -- whichever extreme it is the wiper is getting close to where the problem arises.)

That fixed it, although now it only goes between 8 and 1007, which isn't a problem.

What do the serial1.write commands do? Just curious.

liudr: What do the serial1.write commands do? Just curious.

http://arduino.cc/en/Reference/Serial Looks like it sets different pins as serial read/write.

Spike68:

liudr: What do the serial1.write commands do? Just curious.

http://arduino.cc/en/Reference/Serial Looks like it sets different pins as serial read/write.

You are making no sense.