First hello everyone, I'm new in the Arduino World.
I have my Mega for... two days and doing all the exercises etc. I can find on this site. I also bought a LCD screen that I'm trying to connect to my board. Problem is that the PIN mapping doesn't seem to be the same than on regular Arduino, and I'm a bit at a loss.
Potentiometer and contrast DO work though (I'm proud for a newbie !)
Maybe this has been described many times, but I didn't find by doing searches in the forum, except about the graphical screen which is obviously another beast.
When I try to compile the basic programs I can find, I get the error "error:no matching function for call to 'LiquidCrystal:LiquidCrystal()". It has been installed and is available under sketches, so I guess the problem lies somewhere else. Any pointers welcome, and sorry for being such a noob.
As you noticed, the thread you linked is for a completely different kind of LCD display. Yours uses the LiquidCrystal library and (unlike the Grapical LCD) there is nothing mega specific about the code.
What Arduino version are you using and what is your operating system?
If you made any change to the example sketch or LiquidCrystal library, best to put it back the way it was.
Yes I noticed it was not for the same screen, but I also noticed that in the thread it was said that the pins were not the same on the Mega. So I'm confused now, because if I put the cables as said here for instance : http://arduino.cc/it/Tutorial/LCDLibrary it does not work (of course I map them to the proper pin on my LCD as per the LCD documentation) and I get the error message mentioned above when compiling.
I didn't change anything on the library, just asking
I am using arduino-0016 (the latest release available for download on the official site) with the built-in libraries.
My Arduino is the Mega (are there many releases ?) and I run on the interface on Windows Vista.
The difference between the two libraries is that the LiquidCrystal library uses digitalWrite to set the pins and the graphical library writes directly to the hardware. The graphical library bypasses digitalWrite because it has can make thousands of writes to fill a screen and each write takes up to 30 times longer with digitalWrite. But (unlike the graphical library) digitalWrite will work without change on any of the supported Arduino boards including the mega.
In short – you don't need to change the LiquidCrystal library to use it with the Mega. But you do need to get the wiring to match the code in your sketch.
Is your lcd wired up to match the pins in the example sketch?
Also, if you compile the example sketch and LiquidCrystal library (as distributed), do you get an error?
For the wiring, I'll check, except that on my screens the pins go from 14-->1 then 16, 15 if I read properly the pdf linked above.
But basically, I get a compile error (error:no matching function for call to 'LiquidCrystal:LiquidCrystal()) even with the most basic example. I can understand it could not run if the wiring is not ok, but at least it should compile ok on my computer no ?
Edit : this code (given on the lcd tutorial) does not compile
#include <LiquidCrystal.h> //include LiquidCrystal library
LiquidCrystal lcd = LiquidCrystal(); //create a LiquidCrystal object to control an LCD
void setup(void){
lcd.init(); //initialize the LCD
digitalWrite(13,HIGH); //turn on an LED for debugging
}
void loop(void){
delay(1000); //repeat forever
}
This one does
#include <LiquidCrystal.h>
// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d4, d5, d6, d7 on pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
void setup()
{
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop()
{
}
If so, it is obsolete. It refers to another library with the same name, not the current distributed Arduino library. Perhaps if someone knows how to contact Heather Dewey-Hagborg (the author of that tutorial) it can be updated to reflect the current library (or deleted)
So, stick with the example code that compiles, wire it up as shown in the diagram I posted above and see if it works.
Ok thanks yes I was using that tutorial as a starting point.
Let's try again then. Seems my port mapping is slightly different than the one you gave me, though, but I use it as a sample. Will let you know how that works !
Edit : now backlight + monitor + potentiometer do work, code is ok too (the sample hello world code), but it still doesn't work.
So either I mixed something in the wiring, either I'll check for the other post you mentioned previously.
If it's wired correctly and still doesn't work then follow the link I posted in reply #4. Some LCDs do not initialize correctly with the official LiquidCrystal library. There is a newer version under development that will fix this but it may be some time before it is released. In the mean time you can try the version of the library in that link.
Yes this is what I did. I rechecked and rewired everything too but no success.
Tried also the 4lib but same result...
Here are some pics of my circuit and my screen... (in case I REALLY missed something crucial that I don't see, otherwise it will add some color in that thread !)
You are connecting to the analog in pins. You should be connected to the pins on the other side of the board (they are marked PWM, but really should be marked PWM/DIGITAL)