40x4 lcd problem. First time using Arduino Nano

Got one arduino Nanu with 328 IC.
I am ok with blinking an led so it is working fine. But I am having problem interfacing it with my new 40x4 LCD character display.

This is my code:

#include <LiquidCrystal440.h>


LiquidCrystal lcd(7,6,8,5,4,3,2);

void setup()
{
  lcd.begin(40,4);
  lcd.print("hello, world!");
}

void loop() {}

The error on complier comes as:

In file included from C:\Users\singh_000\Documents\Arduino\RAILWAY_CHALLENGE\RC\RC.ino:1:0:

C:\Users\singh_000\Documents\Arduino\libraries\Liquidcrystal440/LiquidCrystal440.h:95:16: error: conflicting return type specified for 'virtual void LiquidCrystal::write(uint8_t)'

   virtual void write(uint8_t);

                ^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

                 from sketch\RC.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:48:20: error:   overriding 'virtual size_t Print::write(uint8_t)'

     virtual size_t write(uint8_t) = 0;

                    ^

exit status 1
Error compiling.

I have double checked the connections and they are correct and as follows:

You might need an updated LiquidCrystal Library. Versions 1.6.6 and 1.6.7 of the IDE revealed a bug in some early Liquid Crystal Libraries, which -- incorrectly -- used write() as a void, when it needs to return an int (the number of chars written). Earlier versions of the IDE did not seem to care, but now, they do!

Try updating your library (you could try NewLiquidCrystal or others) and see if the compiler problem goes away.

The original LiquidCrystal440 library was written for the Pre Arduino 1.0 IDE. Did you download and use the later version designed for the current IDE? To get a copy start here:--> http://code.google.com/p/liquidcrystal440/ and follow the [u]Downloads[/u] link to get to the latest version.

If that part is OK then take advantage of the fact that your 40x4 display is really set up as two 40x2 devices with all of their pins connected in parallel except for 'E'.

Try using the regular LiquidCrystal library with your program changing the LiquidCrystal.lcd(...) and the lcd.begin(...) arguments of course.

Connect both chip selects of your display to the same Arduino pin and you should get your message on rows 1 and 3 when you run your program.

If that works you can then use two instances of the regular LiquidCrystal library to drive your display. Ask if you need help figuring that part out.

Don

You might need an updated LiquidCrystal Library...

Where would one find such a library. As far as I know the library supplied with the IDE hasn't changed lately (since Arduino v017 I believe).

Don

Thanks all. I tried changing the value to 16x2. It showed hello world on first line (left hand side). I swapped E1 with E2 and the bottom two lines started showing the same text. I joined both together and I get the same same text on both pair of lines as advised.

What should I do next please?

( I extend the text to cover 39 characters) so both lines show it.

Thanks

I joined both together and I get the same same text on both pair of lines as advised.

This means that there's nothing wrong with your display and that you apparently know how to get your constructor to match your wiring.

What should I do next please?

Did you follow the link in reply #2 and get the updated version of LiquidCrystal440 (which now has a different name) that works with the current versions of the Arduino IDE?

Don

[quote author=floresta link=msg=2535707 date=1451098105

Did you follow the link in reply #2 and get the updated version of LiquidCrystal440 (which now has a different name) that works with the current versions of the Arduino IDE?

Don [/quote]

I downloaded it from here:

http://playground.arduino.cc/LCD/EnhancedLiquidCrystal

and got the following compile error:

//------------------------------------------------------------------------- In file included from C:\Users\singh_000\Documents\Arduino\RAILWAY_CHALLENGE\RC\RC.ino:1:0:

C:\Users\singh_000\Documents\Arduino\libraries\Liquidcrystal440/LiquidCrystal440.h:95:16: error: conflicting return type specified for 'virtual void LiquidCrystal::write(uint8_t)'

virtual void write(uint8_t);

^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:224,

from sketch\RC.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:48:20: error: overriding 'virtual size_t Print::write(uint8_t)'

virtual size_t write(uint8_t) = 0;

^

exit status 1 Error compiling.

//-------------------------------------------------------------------------

I downloaded it from here: . . .

Now go back and download the latest version from the link that I provided in reply #2.

You may not be old enough to remember the Black Flag 'Roach Motel' commercials from the early 1980s. The tag line was "Roaches check in, but they don't check out!".

Well, the Arduino playground is something like that. It seems to be relatively easy to post something to the playground but it seems to be impossible to get anything removed. This not only includes obsolete information such as the link you posted but also incorrect or incomplete information.

Don

Thanks florets.

Is it this link (sorry just want to re-confirm).

No it is not the link in your screen shot.

If you follow the instructions in reply #2 you will ultimately get to the version of John's library that was updated for the Arduino 1.0+ versions of the IDE. The filename is LiquidCrystal1.0.zip .

Don

Ok. I downloaded the correct file and got rid of compiling errors but the following is still not working:

/* The circuit:

  • LCD RS pin to digital pin 7
  • LCD Enable pin to digital pin 6
  • LCD Enable2 pin to digital pin 8
  • 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

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7,6,8,5,4,3,2);

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(40, 4);
// Print a message to the LCD.
lcd.print(“hello, world!”);
}

void loop() {

}

I am not surprised. You have a comment block without a terminator.

If you want to post code, please use the code tags. (First icon on the left) Then copy-paste. Do not type by hand.

David.

/*  The circuit:
 * LCD RS pin to digital pin 7
 * LCD Enable pin to digital pin 6
 * LCD Enable2 pin to digital pin 8
 * 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
*/

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
 LiquidCrystal lcd(7,6,8,5,4,3,2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(40, 4);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {

}

Here you go. It was a typo earlier- not closing the commented block

Does it work? I guess you won't really know until you try putting text on the other rows.

Don

No it does not. It does not print anything on the screen when I upload the above code. I am able to do it with lcd1 and lcd2. Would be nice to do it as one lcd.

I guess we need to see a photo of your setup. Make sure it is in focus and that we can unambiguously follow each wire from one end to the other.

Don

I just noticed this in the project description for the library. It looks like you need eight entries in your descriptor.

To use an LCD with 4 lines and 40 columns you would declare your LiquidCrystal object as: LiquidCrystal lcd(RS,RW,Enable1,Enable2, data3,data2,data1,data0); at this time I don’t support 8 data lines. (You can pass 255 as the RW item, ground RW and save an Arduino pin.)

Don

floresta: I just noticed this in the project description for the library. It looks like you need eight entries in your descriptor.

To use an LCD with 4 lines and 40 columns you would declare your LiquidCrystal object as: LiquidCrystal lcd(RS,RW,Enable1,Enable2, data3,data2,data1,data0); at this time I don’t support 8 data lines. u[/u][/u]

Don

That is what I did. I grounded the RW pin so I can free an Arduino pin for something else. But at the same I need to declare 8 entries in LiquidCrystal - I am a little confused here. What should I write for RW entry?

ok, thanks for the help. I got the answer but I could not edit my last post. When I use (7,255,6,8,....) it starts working normally. Thanks to everyone who tried to help again.

Ah, that’s the trick - you don’t need 8 entries; no RS, you only enter seven.

I think you meant RW not RS.

It looks like you need eight entries anyway. You must enter 255 if you are grounding RW. Read the part that singh underlined in reply #17.

If I remember correctly that frees up the constructor with seven arguments for a different configuration.

Don