1

I have an Arduino Uno connected to a LCD. When I try to write to it using the LCD library and the following sketch, it will keep shifting the output around, sometimes drastically.

The sketch:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 10, 11, 9, 8, 7, 6, 5, 4, 3, 2);

void setup () 
{
  lcd.begin (16, 2);
}

void loop () 
{
  lcd.clear ();
  lcd.home ();
  
  for (int i = 0; i < 2; i++)
  {
    for (int j = 0; j < 16; j++)
    {
      lcd.setCursor (j, i);
      lcd.print ("s");
    }
  }

  delay (1000);
}

You would expect it to print

SSSSSSSSSSSSSSSS

SSSSSSSSSSSSSSSS

But it will often print

SSSSSSSSSSSSSSS

SSSSSSSSSSSSSSS

As in, it skips the first line. And, occasionally, it will even print like this:

SSSSSSSSSSS

SSSSSSSSSSS

Is it the LCD's fault, or might there be something wrong with the way it is connected?

EDIT: It is a common Hitachi HD44780-compatible LCD.

EDIT 2: Fritzing View Hopefully it is correctly wired up.

12
  • I don't understand that wiring. What is that regulator doing over to the right, and what is it supposed to be wired to? Where is the power for the LCD coming from? Where is the contrast trimmer?
    – Majenko
    Commented Sep 10, 2015 at 11:27
  • @Majenko The regulator was meant to represent the power. I used that mistakenly (first time using Fritzing. Or doing schematics for that matter). I am not sure how to show the power coming in the breadboard view... What do you mean by contrast trimmer? AFAIK those are all the wire coming out of the LCD.
    – MKII
    Commented Sep 10, 2015 at 11:47
  • @Majenko Hopefully the new image makes more sense
    – MKII
    Commented Sep 10, 2015 at 12:07
  • Is that actually what you're powering the LCD from? Or are you really using a regulated 5V supply?
    – Majenko
    Commented Sep 10, 2015 at 12:19
  • It is a regulated 5V supply. I just don't know how to show that in Fritzing
    – MKII
    Commented Sep 10, 2015 at 12:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.