Go Down

Topic: liquidcrystallib error (Read 1 time) previous topic - next topic

aandnota

i'm doing the original tut by heather and when i go to compile the first sketch, just to test the lcd, it won't compile.  i get this error:

'void pinMode(uint8_t, uint8_t)' here
LiquidCrystal.cpp:9: error: declaration of C function 'void digitalWrite(int, int)' conflicts with
/Applications/arduino-0011/hardware/cores/arduino/wiring.h:98: error: previous declaration 'void digitalWrite(uint8_t, uint8_t)' here
LiquidCrystal.cpp:10: error: declaration of C function 'int digitalRead(int)' conflicts with
/Applications/arduino-0011/hardware/cores/arduino/wiring.h:99: error: previous declaration 'int digitalRead(uint8_t)' here

which, as i understand it means that i need to include the lib, right?  funny thing is, the lib has been imported and referenced in the sketch:

#include <LiquidCrystal.h>

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
}

i'm completely new at this, so what am i doing wrong?

thanks :D

mem

#1
May 16, 2008, 06:57 pm Last Edit: May 16, 2008, 07:00 pm by mem Reason: 1
If you look in liquidcrystal.cpp you will see the following lines:
Code: [Select]
 extern void pinMode(int, int);
 extern void digitalWrite(int, int);
 extern int digitalRead(int);
 extern void portMode(uint8_t, uint8_t);
 extern void portWrite(uint8_t, uint8_t);
 extern uint8_t portRead(uint8_t);


Delete them , they really should never have been put in that code.

The actual defines for those functions come from wiring .h, which will be included in the #include statment before those unwanted extern statements.
You may need to include one more file, but try it with the lines above deleted and see if all the errors go away

aandnota

thanks, that worked beautifully.  one other question, i'm using an av1610 and there is no ostensible contrast pin.  there is pin 3 for "LCD Drive" which i thought might be the contrast equiv.  but i'm not sure.  i hooked everything up in this way and nothing happened.  any ideas?

mem

I am pretty sure the chip used in that panel is compatible with the Hitachi 44780, so pin 3 is the contrast in. You would connect the ends of a 10k or 20k pot to +5v and gnd, and the slider connects to pin 3.

aandnota

ok, i'll give that a shot, thanks.

aandnota

that worked.  thanks, again.

mem

Good to hear its working.

Have fun!

Go Up