Arduino lcd ic2 problems

I NEED HELP MY CODE IS FREAKING OUT

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(1,0);
  lcd.print("hello everyone");
  lcd.setCursor(1,1);
  lcd.print("CC CODE NOT WORKING");
}


void loop()
{
}

PLZ HELP

Welcome to the forum

Exactly which LCD library are you using ? There are several of that name
Do the examples from the library work ?

Not the cause of your problem, but why call init() twice ?

llophj
**I am using this library ** liquid crystal ic2
PLZ HELP ME FIX ITT

As I said

Where did you get it from ?

I GOT IT FOR THIS LINK
GitHub - lucasmaziero/LiquidCrystal_I2C: Library for the LiquidCrystal LCD display connect I2C bus to an ESP8266 or Arduino board

====== GitHub - lucasmaziero/LiquidCrystal_I2C: Library for the LiquidCrystal LCD display connect I2C bus to an ESP8266 or Arduino board ====

THIS IS WHERE I GOT IT FROM

There are several libraries with the name LiquidCrystal_I2C. The are not all the same and code from 1 may not run in another. Those LiquidCrystal_I2C libraries are old and most are not maintained. The newest and best library for I2C LCD with the hd44780 controller (1602, 2004) is the hd44780 library by Bill Perry. The library is available via the IDE library manager.

Here is your code modified to use the hd447780 library. It has been successfully tested on my Uno with a 1602 LCD with I2C backpack.

#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header

//LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
hd44780_I2Cexp lcd; // declare lcd object: auto locate & auto config expander chip

void setup()
{
   //lcd.init();                      // initialize the lcd
   lcd.begin(16,2);
   // Print a message to the LCD.
   lcd.backlight();
   lcd.setCursor(1, 0);
   lcd.print("hello everyone");
   lcd.setCursor(1, 1);
   lcd.print("CC CODE NOT WORKING");
}


void loop()
{
}

If, after loading this code, the display does not show "hello everone", try adjusting the contrast potentiometer on the I2C backpack.

For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

The error shown in the improperly posted code is because of the "CUSTOM PARTS AND ENCLOSUR" that is not valid code. It did not copy with the code that you posted.

image

Images of code are nearly worthless. Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please go back and fix your original post.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

tHANK YOU VERY MUCH

Those are the I2C bus clock and data pins. The I2C bus.

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