'lcd' was not declared HELP

I keep getting the error message 'lcd' was not declared when compiling. Ive checked libraries etc spent hours on google but ive come up blank. Please can someone help me find whats wrong? Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\THE DOMINATOR\Desktop\CLOCK\V_0.3\v03\v03.ino: In function 'void time()':

v03:40: error: 'lcd' was not declared in this scope

lcd.clear();

^

v03:77: error: 'lcd' was not declared in this scope

lcd.setCursor(0,1);

^

C:\Users\THE DOMINATOR\Desktop\CLOCK\V_0.3\v03\v03.ino: In function 'void TimeCheck()':

v03:133: error: 'lcd' was not declared in this scope

lcd.clear();

^

C:\Users\THE DOMINATOR\Desktop\CLOCK\V_0.3\v03\v03.ino: In function 'void setup()':

v03:146: error: 'lcd' was not declared in this scope

lcd.begin(16,2);

^

C:\Users\THE DOMINATOR\Desktop\CLOCK\V_0.3\v03\v03.ino: In function 'void loop()':

v03:175: error: 'lcd' was not declared in this scope

lcd.clear();

^

v03:180: error: 'lcd' was not declared in this scope

lcd.clear();

^

C:\Users\THE DOMINATOR\Desktop\CLOCK\V_0.3\v03\v03.ino: In function 'void current()':

v03:224: error: 'lcd' was not declared in this scope

lcd.setCursor(0,1);

^

Multiple libraries were found for "Wire.h" Used: C:\Users\THE DOMINATOR\Documents\Arduino\libraries\Wire Not used: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire Multiple libraries were found for "RTClib.h" Used: C:\Users\THE DOMINATOR\Documents\Arduino\libraries\RTClibmaster Not used: C:\Users\THE DOMINATOR\Documents\Arduino\libraries\RTClib-master_old exit status 1 'lcd' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Please post your sketch. Do a Tools > Auto Format on it first and use code tags (</> button on the toolbar) when you post it.

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


#define I2C_ADDR 0x27 // <<- Add your address here.
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

RTC_DS1307 RTC;
int tmp, Inc, hor, mIn, add = 11;
int set = 8;
int cge = 9;
int mod = 10;
int off = 0;
#define buz 11
int Hor, Min, Sec;
///////////////////////////////////////Function to adjust the time//////////////////////////////////
void time()
{
  int tmp = 1, mins = 0, hors = 0, secs = 0;
  while (tmp == 1)
  {
    off = 0;
    if (digitalRead(cge) == 0)
    {
      Hor++;
      if (Hor == 24)
      {
        Hor = 0;
      }
    }
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Set Alarm Time ");

    lcd.setCursor(0, 1);
    if (Hor <= 9)
      lcd.print("0");
    lcd.print(Hor);
    lcd.print(":");
    lcd.print(Min);
    lcd.print(":");
    lcd.print(Sec);
    delay(200);
    lcd.setCursor(0, 1);
    lcd.print("  ");
    lcd.print(":");
    lcd.print(Min);
    lcd.print(":");
    lcd.print(Sec);
    delay(200);
    if (digitalRead(set) == 0)
    {
      hor = Hor;
      EEPROM.write(add++, hor);
      tmp = 2;
      while (digitalRead(set) == 0);
    }
  }

  while (tmp == 2)
  {
    if (digitalRead(cge) == 0)
    {
      Min++;
      if (Min == 60)
      {
        Min = 0;
      }
    }
    lcd.setCursor(0, 1);
    lcd.print(Hor);
    lcd.print(":");
    if (Min <= 9)
      lcd.print("0");
    lcd.print(Min);
    lcd.print(":");
    lcd.print(Sec);
    lcd.print("  ");
    delay(200);
    lcd.setCursor(0, 1);
    lcd.print(Hor);
    lcd.print(":");
    lcd.print("  ");
    lcd.print(":");
    lcd.print(Sec);
    lcd.print("  ");
    delay(200);
    if (digitalRead(set) == 0)
    {
      mIn = Min;
      EEPROM.write(add++, mIn);
      tmp = 0;
      while (digitalRead(set) == 0);
    }
  }
  off = 1;
  delay(10);
}
///////////////////////////////////////////function to sound the buzzer//////////////////////////////////
void Buz()
{
  if (digitalRead(set) == 0)
    off = 0;
  if (off == 1)
  {
    digitalWrite(buz, HIGH);
    delay(500);

    digitalWrite(buz, LOW);
    delay(500);
  }
}
//////////////////////////////////////////function to compare the alarm time with current RTC time//////////////////
void TimeCheck()
{
  int tem[17];
  for (int i = 11; i < 17; i++)
  {
    tem[i] = EEPROM.read(i);
  }
  if (Hor == tem[11] && Min == tem[12] && off == 1)
  {
    add = 11;
    Buz();
    Buz();
    lcd.clear();
    lcd.print("alarm...........");
    lcd.setCursor(0, 1);
    lcd.print("...........alarm");
    Buz();
    Buz();
  }
}
////////////////////////////////////////////////////////////setup///////////////////////////
void setup()
{
  Wire.begin();
  RTC.begin();
  lcd.begin(16, 2);
  pinMode(cge, INPUT);
  pinMode(set, INPUT);
  pinMode(mod, INPUT);
  pinMode(buz, OUTPUT);
  digitalWrite(set, HIGH);
  digitalWrite(mod, HIGH);
  digitalWrite(cge, HIGH);

  lcd.setCursor(0, 0);
  lcd.print("ELECTRONICS HUB");
  lcd.setCursor(0, 1);
  lcd.print("  Alarm Clock  ");
  delay(2000);

  if (!RTC.isrunning())
  {
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
}
////////////////////////////////////////////////////////////loop/////////////////////////////////////
void loop()
{
  DateTime now = RTC.now();
  if (digitalRead(mod) == 0)
  {
    current();
    time();
    delay(1000);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("  Alarm On");
    delay(2000);
  }
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Time:");
  lcd.setCursor(6, 0);
  Hor = now.hour(), DEC;
  if (Hor <= 9)
  {
    lcd.print("0");
    lcd.print(Hor = now.hour(), DEC);
  }
  else
    lcd.print(Hor = now.hour(), DEC);
  lcd.print(":");
  Min = now.minute(), DEC;
  if (Min <= 9)
  {
    lcd.print("0");
    lcd.print(Min = now.minute(), DEC);
  }
  else
    lcd.print(Min = now.minute(), DEC);

  lcd.print(":");
  Sec = now.second(), DEC;
  if (Sec <= 9)
  {
    lcd.print("0");
    lcd.print(Sec = now.second(), DEC);
  }
  else
    lcd.print(Sec = now.second(), DEC);
  lcd.setCursor(0, 1);
  lcd.print("Date: ");
  lcd.print(now.day(), DEC);
  lcd.print("/");
  lcd.print(now.month(), DEC);
  lcd.print("/");
  lcd.print(now.year(), DEC);
  TimeCheck();
  delay(200);
}
///////////////////////////////////////////////////////function to get current RTC time//////////////////////////////
void current()
{
  lcd.setCursor(0, 1);
  lcd.print(Hor);
  lcd.print(":");
  lcd.print(Min);
  lcd.print(":");
  lcd.print(Sec);
}

You didn’t declare ‘lcd’ anywhere. Look at the examples for LiquidCrystal_I2C library.

How would I go about declaring ‘lcd’ I thought I had done that… I am very new to arduino by the way. Could you show me what I need to look for? Thanks

It’s pretty easy. Just type this line before your first function and after “#include <LiquidCrystal_I2C.h>”. Like this:

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


#define I2C_ADDR 0x27 // <<- Add your address here.
#define Rs_pin 0
#define Rw_pin 1
#define En_pin 2
#define BACKLIGHT_PIN 3
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

RTC_DS1307 RTC;
LiquidCrystal_I2C lcd; // This is the line that you missed
int tmp, Inc, hor, mIn, add = 11;
int set = 8;
int cge = 9;
int mod = 10;
int off = 0;
#define buz 11
int Hor, Min, Sec;

And that’s it…

Thank you so much! Im new to all this and I was going round in circles. It works!! Thanks again!