Hey guys,
Just got an LCD for my Arduino and am having an issue with the code. It says I am missing a file that is clearly there. Maybe I'm using an older code? Is there a direct link to the LCD Library? There is no link on this page as you would expect. LiquidCrystal - Arduino Reference. The library I downloaded was offsite.
The #include directive has two forms
"filename.h" includes a file in the same directory as your sketch.
<filename.h> includes a file from the libraries sub folder within your sketch folder.
Option 1.
The demo sketch will probably compile if you change
Option 2.
Install the .h and .cpp files as a library
Find your sketch folder
Create a sub folder named 'ibraries'
Create a sub folder in Libraries name 'LiquidCrystal'
Copy LiquidCrystal.h and LiquidCrystal.cpp into your new libraries\LiquidCrystal folder.
#include <LiquidCrystal.h>
Should then find the files.
MattS-UK:
The #include directive has two forms
"filename.h" includes a file in the same directory as your sketch.
<filename.h> includes a file from the libraries sub folder within your sketch folder.
Option 1.
The demo sketch will probably compile if you change
//#include <LiquidCrystal.h>
#include "LiquidCrystal.h"
Ok, I tried this and now I get a new error.
Standard Error Msg.
Arduino: 1.5.7 (Windows 7), Board: "Arduino Uno"
In file included from HelloWorld.pde:39:0:
LiquidCrystal.h:7:17: fatal error: SPI.h: No such file or directory #include <SPI.h>
^
compilation terminated.
In file included from HelloWorld.pde:39:0:
C:\Users\Rob\AppData\Local\Temp\build3632887940634616561.tmp\LiquidCrystal.h:7:17: fatal error: SPI.h: No such file or directory #include <SPI.h>
^
compilation terminated.
Should I just delete these files and start over?
Thanks for the help!
It is included as part of the IDE package. There is no need to download anything. Doing so is a mistake.
The files I'm using were not in my "examples". I had to download it. When I copied and pasted the code below into IDE, it was asking for "LiquidCrystal.ccp" and "LiquidCrystal.h". After downloading and extracting LiquidCrystal.zip ( I can't remember where atm), I got all the examples and files it was asking for but still had a prob with "LiquidCrystal.h". Now as you see in the previous response, I get a different error that I haven't had yet. I attached a pic of the examples I gained in the zip.
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}