No such file or directory...

Hi guys!

I appologise if it's a stupid question. I'm a total beginer in ˝Arduino buisness.˝
I have bought an Arduino mega 2560, and a I2C LCD 16x2. I went trough the instructions but I still have a basic problem. Namely, when I check the code it report an error:

.ino:18:17: fatal error: LCD.h: No such file or directory

I don't understand the error couse I followed the well described instructions ([SOLVED] I2C LCD - Setup instructions for 16x2 - Displays - Arduino Forum) and through the following steps:

This tutorial is based on version LiquidCrystal_V1.2.1.zip

This library REPLACES the standard one in Arduino V1.0. So

  • rename the existing LCD library directory
  • unzip the new library
  • place the folder LiquidCrystal into the library folder.
  • Start up the Arduino IDE

I did exactly this and it report above mentioned error.
In fact it seems that wire.h is ˝detected˝ while LCD.h and LIquidCrystal_I2C.h are not.

Is anyone so kind and would help me please?

Thanks a lot,

Jonathan

Sigh.....

Please post your program (all of it) using code tags.
Do you have LCD.h and if so, where is it located ?

Ok, sorry for lack of information.

So. I'm have:
-Arduino mega 2560
-LCD (http://www.ebay.com/itm/251471058918?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT)

...which are conected. GRD to GRD, VCC to 5V, SDA to SDA (input 20),SCL to SCL (input 21).

  1. I downloaded librarie: LiquidCrystal version 1.21 from https://bitbucket.org/fmalpartida/new-liquidcrystal.
  2. After unziping, I renamed old folder (liquid crystal) in ...program files\Arduino\libraries and copied inside a new (1.21 vesrion) folder and named it LiquidCrystal.
  3. I started arduino IDE and past in the following code:

/*
** Example Arduino sketch for SainSmart I2C LCD2004 adapter for HD44780 LCD screens
** Readily found on eBay or http://www.sainsmart.com/
** The LCD2004 module appears to be identical to one marketed by YwRobot
**
** Address pins 0,1 & 2 are all permenantly tied high so the address is fixed at 0x27
**
** Written for and tested with Arduino 1.0
** This example uses F Malpartida's NewLiquidCrystal library. Obtain from:
** https://bitbucket.org/fmalpartida/new-liquidcrystal
**
** Edward Comer
** LICENSE: GNU General Public License, version 3 (GPL-3.0)
**
** NOTE: TEsted on Arduino NANO whose I2C pins are A4==SDA, A5==SCL
*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR 0x27 // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

int n = 1;

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

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

// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home

lcd.print("SainSmart I2C tester");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("F Malpartida library");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print("Test & demonstration");
lcd.setCursor ( 0, 3 ); // go to the fourth line
lcd.print("Iteration No: ");
}

void loop()
{
// Backlight on/off every 3 seconds
lcd.setCursor (14,3); // go col 14 of line 3
lcd.print(n++,DEC);
lcd.setBacklight(LOW); // Backlight off
delay(3000);
lcd.setBacklight(HIGH); // Backlight on
delay(3000);
}

  1. Here I stucked. After checking, it report an error: ino.18:17: fatal error: LCD.h: No such file or directory.
    I browsed a bit in map LiquidCrystal, where if found file LCD.h

If I have to give more information, please tell me.

Thanks a lot!
Jonathan

There is one important thing to know: the folder must have the same name as the .cpp file of the library... I agree, it's stupid :wink:

Ok, I solved the problem.
The problem was that in .zip file....there exist ti folder. First one is LiquidCrystal (which I copied in my libraries) and the second one is _MACOSX. The latter contains also a map LiquidCrystal and if I copy this map. It works. :slight_smile:

Thanks anyway for help!