ambiguous??

hello,

I"m trying to upload project 23 from "Beginning Arduino" but I'm getting an error?

error: "call of overload 'write(int)' is ambiguous"
Project23.pde: In function 'void createGlyphDemo()':
Project23:124: error: call of overloaded 'write(int) is ambiguous
c:\arduino-1.0.4\libraries\LiquidCrystal\LiquidCrystal.h:82: note: candidates are : virtual size_t LiquidCrystal: :write(unit8_t)
c:\arduino-1.0.4\hardware\arduino\cores\arduino/Print.h:49: note: size_t Print: :write(const char*)

// PROJECT 23
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // create an lcd object and assign the pins

void setup() {
  	lcd.begin(16, 2); // Set the display to 16 columns and 2 rows
}

void loop() {
  	// run the 7 demo routines
  	basicPrintDemo();
  	displayOnOffDemo();
  	setCursorDemo();
  	scrollLeftDemo();
  	scrollRightDemo();
  	cursorDemo();
  	createGlyphDemo();
}

void basicPrintDemo() {
    	lcd.clear(); // Clear the display
    	lcd.print("Basic Print"); // print some text
    	delay(2000);
}

void displayOnOffDemo() {
  	lcd.clear(); // Clear the display  
  	lcd.print("Display On/Off"); // print some text
  	for(int x=0; x < 3; x++) { // loop 3 times
    		lcd.noDisplay(); // turn display off
    		delay(1000);
    		lcd.display(); // turn it back on again
    		delay(1000);
    }
}

void setCursorDemo() {
  	lcd.clear(); // Clear the display
  	lcd.print("SetCursor Demo"); // print some text
  	delay(1000);
  	lcd.clear(); // Clear the display
  	lcd.setCursor(5,0); // cursor at column 5 row 0
  	lcd.print("5,0");
  	delay(2000);
  	lcd.setCursor(10,1); // cursor at column 10 row 1
  	lcd.print("10,1");
  	delay(2000);
  	lcd.setCursor(3,1); // cursor at column 3 row 1
  	lcd.print("3,1");
  	delay(2000);
}

void scrollLeftDemo() {
  	lcd.clear(); // Clear the display
  	lcd.print("Scroll Left Demo");
  	delay(1000);
  	lcd.clear(); // Clear the display
  	lcd.setCursor(7,0);
  	lcd.print("Beginning");  
  	lcd.setCursor(9,1);
  	lcd.print("Arduino");
  	delay(1000);
  	for(int x=0; x<16; x++) {
    		lcd.scrollDisplayLeft(); // scroll display left 16 times
    		delay(250);
  	}
}

void scrollRightDemo() {
  	lcd.clear(); // Clear the display
  	lcd.print("Scroll Right");
  	lcd.setCursor(0,1);
  	lcd.print("Demo");
  	delay(1000);
  	lcd.clear(); // Clear the display
  	lcd.print("Beginning");  
  	lcd.setCursor(0,1);
  	lcd.print("Arduino");
  	delay(1000);
  	for(int x=0; x<16; x++) {
    	lcd.scrollDisplayRight(); // scroll display right 16 times
    		delay(250);
  	}
}

void cursorDemo() {
  	lcd.clear(); // Clear the display
  	lcd.cursor(); // Enable cursor visible
  	lcd.print("Cursor On");
  	delay(3000);
  	lcd.clear(); // Clear the display
  	lcd.noCursor(); // cursor invisible
  	lcd.print("Cursor Off");
  	delay(3000);
  	lcd.clear(); // Clear the display
	lcd.cursor(); // cursor visible
  	lcd.blink(); // cursor blinking
  	lcd.print("Cursor Blink On");
	delay(3000);
  	lcd.noCursor(); // cursor invisible
  	lcd.noBlink(); // blink off
}


void createGlyphDemo() {
  	lcd.clear();

  	byte happy[8] = { // create byte array with happy face
  	B00000,
  	B00000,
  	B10001,
  	B00000,
  	B10001,
  	B01110,
  	B00000,
  	B00000};
  
  	byte sad[8] = { // create byte array with sad face
  	B00000,
  	B00000,
  	B10001,
  	B00000,
  	B01110,
  	B10001,
  	B00000,
  	B00000};
  	lcd.createChar(0, happy); // create custom character 0
  	lcd.createChar(1, sad); // create custom character 1
 
 	for(int x=0; x<5; x++) { // loop animation 5 times
   		lcd.setCursor(8,0);
    		lcd.write(0); // write custom char 0
    		delay(1000);
    		lcd.setCursor(8,0);
    		lcd.write(1); // write custom char 1
    		delay(1000);
  	}
}

any help would be appreciated, thanks!

I'm not confident enough with my C++ to give you an accurate description, but from what I've see it looks as though the '0' in

lcd.write(0);

cannot be determined explicitly as a uint_8, or a pointer (char *)... I don't know if this is a condition of a null/zero value.

A quick experiment (untested, but compiled)...

Change the character code 0, to 2...

  	byte sad[8] = { // create byte array with sad face
  	B00000,
  	B00000,
  	B10001,
  	B00000,
  	B01110,
  	B10001,
  	B00000,
  	B00000};
  	lcd.createChar(2, happy); // create custom character 0
  	lcd.createChar(1, sad); // create custom character 1
 
 	for(int x=0; x<5; x++) { // loop animation 5 times
   		lcd.setCursor(8,0);
    		lcd.write(2); // write custom char 0
    		delay(1000);
    		lcd.setCursor(8,0);
    		lcd.write(1); // write custom char 1
    		delay(1000);
  	}
}

or cast the null value explicitly....

  	byte sad[8] = { // create byte array with sad face
  	B00000,
  	B00000,
  	B10001,
  	B00000,
  	B01110,
  	B10001,
  	B00000,
  	B00000};
  	lcd.createChar(0, happy); // create custom character 0
  	lcd.createChar(1, sad); // create custom character 1
 
 	for(int x=0; x<5; x++) { // loop animation 5 times
   		lcd.setCursor(8,0);
    		lcd.write((uint8_t) 0); // write custom char 0
    		delay(1000);
    		lcd.setCursor(8,0);
    		lcd.write(1); // write custom char 1    <-- Not necessary to cast non-zero?
    		delay(1000);
  	}

I was able to confirm that it needs to be type casted as uint8_t. Why it sees 0 as an int, and everything else as uint8_t is beyond me.

thanks for the help!

I first tried hazards way but with no luck, I then tried Doddy's way and they both worked. I played around with the numbers and it only errors when I put a zero in the mix.

In the the book it say's:
"Then you create the two custom characters using the createChar() command. This requires two parameters: the first is the number of the custom character(0-7 in the case of my test LCD, which can store a maximum of 8), and the second is the name of the array...."

I guess it must be the LCD.

Anyways thanks, and thanks for the unit8_t info I'm not sure what it is but I see it pop up a lot in the errors, guess I should spend some time trying understand it.

You should be able to display the custom character that you stored at 0 by using:

lcd.write(8);

Don