Sample code for 128*64 lcd display won't compile

I downloaded the file on this page (Arduino Playground - GLCDks0108), which includes an example for the KS0108 LCD that I got from Adafruit (Graphic KS0108 LCD 128x64 + extras [white on blue] : ID 188 : $24.95 : Adafruit Industries, Unique & fun DIY electronics and kits), but when I go to compile, I get errors that I don't know how to fix.

Here's the sample given.

/*
 * GLCDexample
 *
 * Basic test code for the Arduino KS0108 GLCD library.
 * This code exercises a range of graphic functions supported
 * by the library and is an example of its use.
 * It also gives an indication of performance, showing the
 *  number of frames drawn per second.  
 */

#include <ks0108.h>
#include <Arial14.h>  // font definitions 
#include <SystemFont5x7.h>

unsigned long startMillis;
unsigned int loops = 0;
unsigned int iter = 0;

void setup(){
  GLCD.Init(NON_INVERTED);   // initialise the library, non inverted writes pixels onto a clear screen
  introScreen();              // show some intro stuff 
  GLCD.ClearScreen();
}

void introScreen(){
  GLCD.SelectFont(Arial_14); // you can also make your own fonts, see playground for details   
  GLCD.GotoXY(20, 2);
  GLCD.Puts("GLCD  version 1.1");
  GLCD.DrawRoundRect(16,0,99,18, 5, BLACK);  // rounded rectangle around text area   

  GLCD.SelectFont(System5x7); // switch to fixed width system font 
  showCharacters();
 
  for(byte count=9; count >0; count--){  // do countdown  
     GLCD.CursorTo(0,1);   // first column, seconds row (offset is from 0)
     GLCD.PutChar(count + '0');
     delay(1000);  
  }  
}

void showCharacters(){
  byte line = 3; // start on the fourth line 
  for(byte c = 32; c <=127; c++){
     if( (c-32) % 20 == 0)
         GLCD.CursorTo(1,line++);  // CursorTo is used for fixed width system font
     GLCD.PutChar(c);    
  }   
}

void drawSpinner(byte pos, byte x, byte y) {   
  // this draws an object that appears to spin
  switch(pos % 8) {
  case 0 : GLCD.DrawLine( x, y-8, x, y+8, BLACK); break;
  case 1 : GLCD.DrawLine( x+3, y-7, x-3, y+7, BLACK);  break;
  case 2 : GLCD.DrawLine( x+6, y-6, x-6, y+6, BLACK);  break;
  case 3 : GLCD.DrawLine( x+7, y-3, x-7, y+3, BLACK);  break;
  case 4 : GLCD.DrawLine( x+8, y, x-8, y, BLACK);  break;
  case 5 : GLCD.DrawLine( x+7, y+3, x-7, y-3, BLACK);  break;
  case 6 : GLCD.DrawLine( x+6, y+6, x-6, y-6, BLACK);  break; 
  case 7 : GLCD.DrawLine( x+3, y+7, x-3, y-7, BLACK);  break;
  } 
}

void  loop(){   // run over and over again
  iter = 0;
  startMillis = millis();
  while( millis() - startMillis < 1000){ // loop for one second
    GLCD.DrawRect(0, 0, 64, 61, BLACK); // rectangle in left side of screen
    GLCD.DrawRoundRect(68, 0, 58, 61, 5, BLACK);  // rounded rectangle around text area   
    for(int i=0; i < 62; i += 4)
      GLCD.DrawLine(1,1,63,i, BLACK);  // draw lines from upper left down right side of rectangle  
    GLCD.DrawCircle(32,31,30,BLACK);   // draw circle centered in the left side of screen  
    GLCD.FillRect(92,40,16,16, WHITE); // clear previous spinner position  
    drawSpinner(loops++,100,48);       // draw new spinner position
    //GLCD.FillRect(24,txtLINE3,14,14, WHITE);  // clear text area that will be drawn below 
    GLCD.CursorTo(5,5);               // locate curser for printing text
    GLCD.PrintNumber(++iter);         // print current iteration at the current cursor position 
  } 
  // display number of iterations in one second
  GLCD.ClearScreen();               // clear the screen  
  GLCD.CursorTo(14,2);              // positon cursor  
  GLCD.Puts("FPS= ");               // print a text string
  GLCD.PrintNumber(iter);           // print a number 
}

I am using the arduino mega (the latest version of this board).

Could someone please help me with a working sample?

Thanks!

The sketch compiles ok for me. Its difficult to help if you don't say what the errors are.

First thing to check is that the library is installed in the correct place.
To install a library , unzip the library to a sub-directory of the libraries sub-directory of your Arduino sketchbook directory (shown in the Arduino preferences dialog). If this is the first library you've installed, you'll need to create the libraries directory. After unzipping the library, (re-)launch the Arduino environment; you should see the library in the Import Library menu.

Also, make sure you have the mega board selected from the tools/board menu

If you still have problems, post the error messages and say what operating system and arduino version you are running.

The product sold by adafruit at Nov 2009 is KS0108 and 7 chipsets
The LCD is driven by on-board 5V parallel interface chipset KS0108 and KS0107. They are extremely common and well documented

Adafruit Industries, Unique & fun DIY electronics and kits ... cts_id=188

TAKE NOTE - If you make a mistake and reverse the board completely and connect up pins 1->20 as advised it works OK as far as lighting up and contrast control but that is all that you will get. Just reverse the unit completely by turning it around in the breadboard, if you can, and voila , all works.

From silly personal experience

The above sketch compiles and runs OK for me too on an ATMega328 if thats any help. Shows about 8 frames per second

The sketch works fine for me too with the same LCD.

My guess is you haven't installed the library correctly, or not even seen it. Follow mem's directions for installing the library and try compile it again.