What library to install for LCM1602C LCD display

My Arduino Uno came with a kit. The kit contains a LCM1602C LCD display. But I keep running into problems trying to get the "Hello World:" project to work, mainly:

compilation error: LiquidCrystal.h: No such file or directory

I reinstalled the Arduino IDE software (2.2.1) and installed one of the LiquidCrystalDisplay libraries (there are several), but I was getting the same error.

So starting over again. I deleted all things Arduino from my Mac and reinstalled Arduino Ide (2.2.1). The magic question: which of the LiquidCrystalDisplay libraries do i install for this particular lcd display? Or is there a more comprehensive instruction that includes the code and exactly which library to install? It's frustrating there are so many variants of the Hello World projects, none of which seem to work on my system.

My favorite library for the 1602 and 2004 hd55780 controlled character LCDs is the hd44780 library by Bill Perry.

If your LCD is the bare 1602 LCD (not I2C) use the hd44880_pinIO class.

The hd44780 library is available to install using the IDE library manager. How to install an Arduino library.

Here is my simple test code for the 4 pin parallel non I2C LCD:

#include <hd44780.h>
#include <hd44780ioClass/hd44780_pinIO.h> // Arduino pin i/o class header

const int rs = 8, en = 9, db4 = 4, db5 = 5, db6 = 6, db7 = 7; // for all other devices

hd44780_pinIO lcd(rs, en, db4, db5, db6, db7);

// LCD geometry
const int LCD_COLS = 16;
const int LCD_ROWS = 2;

void setup()
{
   lcd.begin(LCD_COLS, LCD_ROWS);
   lcd.print("Hello, World!");
   lcd.setCursor(0, 1);
   lcd.print("millis = ");
}

void loop()
{
   static unsigned long timer = 0;
   unsigned long interval = 1000;
   if (millis() - timer >= interval)
   {
      timer = millis();

      lcd.setCursor(10, 1);
      lcd.print(millis());
   }
}

Thank you. I got it working!

Happy to have helped.

If your question has been answered to your satisfaction please mark the thread as solved so that other members that wish to help will not waste time opening the thread only to find that the question has been answered.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.