Help, LCD Display

Hi, so I am having problems with my new LCD Display. I haven’t ever used one before, but I got some sample code:

#include "LiquidCrystal.h"

// initialize the library by providing the nuber of pins to it
LiquidCrystal lcd(8,9,4,5,6,7);

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

// set cursor position to start of first line on the LCD
lcd.setCursor(0,0);
//text to print
lcd.print("    COUNTER");
delay(100);

int a=0;
lcd.setCursor(0,1);
lcd.print("       ");
lcd.print(a);
while(a<=100)
{
  a=a+1;
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("       ");
  lcd.print(a);
}
}
void loop()
{
  lcd.clear();
}

and wired up my LCD according to this site: Interface an LCD with an Arduino - Projects

however, nothing happens, and it doesn’t appear to work. Is there something wrong with the code or wiring? Also, what does the pot do?

Thanks!

Also, what does the pot do?

If you smoke it, it gets you high.

You didn't post a link to the LCD, so we only surmise that you've been smoking too much pot.

I meant the Potentiometer :) Do you mean a link to where I bought the LCD? I thought they were all the same. Here is the link to where I bought it: https://tinyurl.com/y9pztok6

Character intensity adjustment On LCD power-up , no code yet running ! , you should adjust this pot until you see line(s) on 5x7 dots characters.

I changed the code to this:

#include "LiquidCrystal.h"

// initialize the library by providing the nuber of pins to it
LiquidCrystal lcd(8,9,4,5,6,7);

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

void loop() {
  lcd.setCursor(0,1);
  lcd.print("Hello World");
}

I then turned the pot slowly back and forth and nothing happened.

Ok, so as I was messing around with it, I accidentally bumped it, and then stuff flickered on. I figured out that if I bend it around, then I can get it to work a little. At one point, I got it just right so that it said the right words and everything. However, I can't get it in just the right bend again. I have it on some male pins out from my breadboard, but I don't know how to get it to connect better.

What arduino board are you using? If its less than 5V display might not have enough power, try a 5V arduino board with example code.

What are you bending? The display? Wires? Are you using a bread board?

There is an old saying - it works better when you plug it in. I guess my comment about NOT running ANY code and then adjusting the pot did not sink in. Just connect the + and grounds to BOTH LCD supply and backlight LED and do you intensity adjustment after the device goes thru its power-on sequence - automatically. . It is possible that your is also controlling the backlight so you are better off not running code until you have working hardware.

Not to worry about how much power you drawing - these LCD been around for few yeas and are not that hungry by itself - its the backlight LED that takes few mA.

I have it on some male pins out from my breadboard, but I don't know how to get it to connect better.

Probably a silly question, but are the pins soldered to the LCD?

Okay guys, thanks for all the question helps, I think I got it mostly figured. So, I was just using some straight male to male pins from my breadboard to each hole in the LCD, and when I gently bent/tipped the lcd display backward or forward, it would sometimes work. So then I knew that it was a problem of bad connectivity. And then, yes, I soldered the pins to the LCD, and now it works great. Will it work to use my IR Remote to change the text on the LCD?

Vulcan666: Okay guys, thanks for all the question helps, I think I got it mostly figured. So, I was just using some straight male to male pins from my breadboard to each hole in the LCD, and when I gently bent/tipped the lcd display backward or forward, it would sometimes work. So then I knew that it was a problem of bad connectivity.

Never use loose connections; recipe for problems (as you have figured).

Vulcan666: Will it work to use my IR Remote to change the text on the LCD?

If you code it properly, yes :)

Okay, why doesn’t this work?

//----------------------------Libraries
#include <LiquidCrystal.h>
#include "IRremote.h"
#include "Servo.h"

//----------------------------Servo Pre-Setup
Servo AlarmServo;

//----------------------------Remote Pre-Setup
int receiver = 12;
IRrecv irrecv(receiver);
decode_results results;

//--------------------------------------LCD Pre-Setup
LiquidCrystal lcd(0, 1, 8, 9, 10, 11);

void setup() {  // - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -Void Setup()

  //----------------------------LCD Setup
  lcd.begin(16, 2);
  lcd.print(" LD Alarm Clock");

  //----------------------------Servo Setup
  AlarmServo.write(5);
  AlarmServo.attach(10);

  //----------------------------Remote Setup
  Serial.begin(9600);
  irrecv.enableIRIn();
  pinMode(52, OUTPUT);
}

void loop() {//- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -Void Loop()

  //--------------------------------------------Remote Functions/Setup
  if (irrecv.decode(&results))   {
    switch (results.value)  {

      //------------------Button: 1
      case 0xFF6897:
        lcd.write("Howdy");
        digitalWrite(52, HIGH);
        break;

        //------------------Remote Setup Finish
        delay(250);
        irrecv.resume();

    }
  }
}

the led turns on but the lcd display doesn’t change from “LD Alarm Clock” to “howdy”

Why do you use pins 0 and 1 for the LCD? Those pins are also used for the serial port.

Use different pins for the LCD.

Okay, thanks so much, it works now. However, now it says howdyhowdyhowdyhowdy without end, how do I make it say it once? I put it on those pins because I looked up a diagram and that was how it was wired. Guess they didn't have ir remote plans in mind:)

how do I make it say it once?

Move the irrecv.resume() out of the switch/case.

case 0xFF6897:
        lcd.write("Howdy");
        digitalWrite(52, HIGH);
        break;
    }
     irrecv.resume();
  }

Remove the delay from the switch/case for a more responsive sketch.

Guess they didn't have ir remote plans in mind:

pins 0 & 1 are for the Serial port, they have noting to do with IR remote.

I put it on those pins because I looked up a diagram and that was how it was wired.

What you saw was probably the wiring for a LCD to an I2C expander. Not applicable for your LCD.