Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

Following tutorial, LCD w/backpack example won't compile
Moderators: adafruit_support_bill, adafruit

Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 12:19 pm

I have a new Adafruit LCD backpack. It is connected to a 20x4 character display on a MEGA2650R3 pins 20 and 21. I deleted the 10 pin "LiquidCrystal" library. Downloaded the Adafruit
backpack library. Loaded the "HelloWorld" example sketch for I2C. It won't compile. I have Arduino.exe ver 1.0.4 IDE. I changed the ext of the sketch from .pde to .ino The above problem is with or without the backpack connected to the MEGA.
Any suggestions?
Thanks

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by adafruit_support_bill on Fri Mar 29, 2013 12:25 pm

It won't compile.

Post the text of the compiler error.

adafruit_support_bill
 
Posts: 37544
Joined: Sat Feb 07, 2009 10:11 am

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 12:31 pm

HelloWorld_i2c:21: error: no matching function for call to 'LiquidCrystal::LiquidCrystal(int)'
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:56: note: candidates are: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:54: note: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:52: note: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:49: note: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:45: note: LiquidCrystal::LiquidCrystal(const LiquidCrystal&)
HelloWorld_i2c.ino: In function 'void loop()':
HelloWorld_i2c:37: error: 'class LiquidCrystal' has no member named 'setBacklight'
HelloWorld_i2c:39: error: 'class LiquidCrystal' has no member named 'setBacklight'

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by adafruit_support_bill on Fri Mar 29, 2013 1:16 pm

Looks like you still have the old library there.

adafruit_support_bill
 
Posts: 37544
Joined: Sat Feb 07, 2009 10:11 am

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 1:32 pm

OK. Send me a link to the new one. I just downloaded this one this morning.
Thank you.

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by adafruit_support_bill on Fri Mar 29, 2013 1:38 pm

This is the Adafruit version with i2c support for the backpack: https://github.com/adafruit/LiquidCrystal

adafruit_support_bill
 
Posts: 37544
Joined: Sat Feb 07, 2009 10:11 am

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 1:45 pm

OK.I deleted the old LiquidCrystal from the Arduino/Libraries folder. Downloaded the new one and extracted it into Arduino/Libraries. See the new error dump.

HelloWorld_i2c:21: error: no matching function for call to 'LiquidCrystal::LiquidCrystal(int)'
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:56: note: candidates are: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:54: note: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:52: note: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:49: note: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:45: note: LiquidCrystal::LiquidCrystal(const LiquidCrystal&)
HelloWorld_i2c.ino: In function 'void loop()':
HelloWorld_i2c:37: error: 'class LiquidCrystal' has no member named 'setBacklight'
HelloWorld_i2c:39: error: 'class LiquidCrystal' has no member named 'setBacklight'

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 1:56 pm

Look at the #include lines... " instead of <> I tried changing that but it still didn't compile. Looked like the same errors.

/*
Demonstration sketch for Adafruit i2c/SPI LCD backpack
using MCP23008 I2C expander
( http://www.ladyada.net/products/i2cspil ... index.html )

This sketch prints "Hello World!" to the LCD
and shows the time.

The circuit:
* 5V to Arduino 5V pin
* GND to Arduino GND pin
* CLK to Analog #5
* DAT to Analog #4
*/

// include the library code:
#include "WIre.h"
#include "LiquidCrystal.h"

// Connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidCrystal lcd(0);

void setup() {
// set up the LCD's number of rows and columns:
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);

lcd.setBacklight(HIGH);
delay(500);
lcd.setBacklight(LOW);
delay(500);
}

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by adafruit_support_bill on Fri Mar 29, 2013 2:13 pm

Where did you install the new library?
Did you completely remove the old library from the Arduino install folder? It is not enough to rename it.
Did you re-start the IDE after installing the library? You must exit ALL instances of the IDE and restart befor the IDE will recognize the new library.

See here for more details: http://learn.adafruit.com/adafruit-all- ... -a-library

adafruit_support_bill
 
Posts: 37544
Joined: Sat Feb 07, 2009 10:11 am

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 2:23 pm

I deleted the LiquidCrystal folder from the Arduino libraries folder.
I installed the library in Desktop > arduino-1.0.4 . > libraries
I renamed library folder by deleting the "-master", as the tutorial says to do.
I then renamed the name of the sketch from HelloWorld_i2c.pde to HelloWorld_i2c.ino.
I double clicked the file name and Arduino IDE opened up with the file as I copied and pasted into my last post.
Nothing more, nothing less.

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by adafruit_support_bill on Fri Mar 29, 2013 2:29 pm

I installed the library in Desktop > arduino-1.0.4 . > libraries

Not the best location But it does not explain the compiler errors you are seeing.

Post the text of your LiquidCrystal.h file.

adafruit_support_bill
 
Posts: 37544
Joined: Sat Feb 07, 2009 10:11 am

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 2:33 pm

#ifndef LiquidCrystal_h
#define LiquidCrystal_h

#include <inttypes.h>
#include "Print.h"
#include "Adafruit_MCP23008.h"

// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x20
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80

// flags for display entry mode
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00

// flags for display on/off control
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00

// flags for display/cursor shift
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00

// flags for function set
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00

class LiquidCrystal : public Print {
public:
LiquidCrystal(uint8_t rs, uint8_t enable,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
LiquidCrystal(uint8_t rs, uint8_t enable,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);

LiquidCrystal(uint8_t i2cAddr);
LiquidCrystal(uint8_t data, uint8_t clock, uint8_t latch);

void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);

void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);

void clear();
void home();

void noDisplay();
void display();
void noBlink();
void blink();
void noCursor();
void cursor();
void scrollDisplayLeft();
void scrollDisplayRight();
void leftToRight();
void rightToLeft();
void autoscroll();
void noAutoscroll();

// only if using backpack
void setBacklight(uint8_t status);

void createChar(uint8_t, uint8_t[]);
void setCursor(uint8_t, uint8_t);
#if ARDUINO >= 100
virtual size_t write(uint8_t);
#else
virtual void write(uint8_t);
#endif
void command(uint8_t);
private:
void send(uint8_t, uint8_t);
void write4bits(uint8_t);
void write8bits(uint8_t);
void pulseEnable();
void _digitalWrite(uint8_t, uint8_t);
void _pinMode(uint8_t, uint8_t);

uint8_t _rs_pin; // LOW: command. HIGH: character.
uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
uint8_t _enable_pin; // activated by a HIGH pulse.
uint8_t _data_pins[8];

uint8_t _displayfunction;
uint8_t _displaycontrol;
uint8_t _displaymode;

uint8_t _initialized;

uint8_t _numlines,_currline;

uint8_t _SPIclock, _SPIdata, _SPIlatch;
uint8_t _SPIbuff;

uint8_t _i2cAddr;
Adafruit_MCP23008 _i2c;
};

#endif

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 2:36 pm

By the way, how is being under "My Documents" better than under "Desktop"?

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm

Re: Following tutorial, LCD w/backpack example won't compile

by adafruit_support_bill on Fri Mar 29, 2013 2:48 pm

That is the correct file. It has the constructor prototype that the compiler is not finding:
Code: Select all | TOGGLE FULL SIZE
LiquidCrystal(uint8_t i2cAddr);


As well as the setBacklight it is not finding.
Code: Select all | TOGGLE FULL SIZE
void setBacklight(uint8_t status);


Are you sure you closed ALL instances of the IDE before opening the example sketch?

how is being under "My Documents" better than under "Desktop"?


From the tutorial:
User installed libraries should be installed in your sketchbook libraries folder so they can be used with all versions of the IDE. This way, if a new version of the IDE is released, you don't have to re-install all your favorite libraries!

adafruit_support_bill
 
Posts: 37544
Joined: Sat Feb 07, 2009 10:11 am

Re: Following tutorial, LCD w/backpack example won't compile

by oldfox on Fri Mar 29, 2013 3:00 pm

There were NO instances of the IDE open. I opened the IDE by double clicking the sketch filename. Just like I do with all other sketches.
Thank you for the pointer on installing "user" libraries. When I said I had followed the tutorial, I meant the backpack tutorial. I have never seen a "sketchbook libraries folder". Where would it normally be located?

oldfox
 
Posts: 41
Joined: Wed Jan 23, 2013 4:18 pm