I2C LCD Library Problem in 2.0.3 Editor

Hi,
I was experimenting with LCD displays using I2C and copied some basic code with the library <LiquidCrystal_I2C.h> I uploaded the code to my uno board and all of a sudden, this error message pops up.

C:\Users\palla\Documents\Arduino\I2c_Adrs_Finder\ESC_Ctrls.ino: In function 'void setup()':
C:\Users\palla\Documents\Arduino\I2c_Adrs_Finder\ESC_Ctrls.ino:6:6: error: redefinition of 'void setup()'
 void setup()
      ^~~~~
C:\Users\palla\Documents\Arduino\I2c_Adrs_Finder\I2c_Adrs_Finder.ino:7:6: note: 'void setup()' previously defined here
 void setup() {
      ^~~~~
C:\Users\palla\Documents\Arduino\I2c_Adrs_Finder\ESC_Ctrls.ino: In function 'void loop()':
C:\Users\palla\Documents\Arduino\I2c_Adrs_Finder\ESC_Ctrls.ino:19:6: error: redefinition of 'void loop()'
 void loop()
      ^~~~
C:\Users\palla\Documents\Arduino\I2c_Adrs_Finder\I2c_Adrs_Finder.ino:40:6: note: 'void loop()' previously defined here
 void loop() {}
      ^~~~

exit status 1

Compilation error: redefinition of 'void setup()'

Do any of you know what I should do?
Here is my code:

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

LiquidCrystal_I2C lcd(0x27,20,4);  // 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("This works");
}


void loop()
{
}

And

You have 2 .ino file in the same map. Each of them had setup and loop in it. That will not work. Remove setup and loop from ESC_Ctrls.ino

Thanks. I have another question. I can't see the text printing. Do you know why this is happening?

There could be a number of reasons:

  1. The display is not at address 0x27 (use I2C scanner to verify)
  2. SDA/SCL connections reversed
  3. Contrast setting needs to be adjusted

I also found that the 2004 display struggled when powered from the Arduino 5V rail and contrast was much better when it was powered from an external 5V power supply.

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