Using Graphics LCD: KS0108 LCD 128x64

i'm having an error in compiling my codes. please help, thank you. the error states:

Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\CUTE\Documents\Arduino\libraries\ks0108\ks0108.cpp:33:67: fatal error: wiring.h: No such file or directory

#include <wiring.h> // added 18 Sept 2008 for Arduino release 0012

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

-this is my code.

#include <ArduinoIcon.h>
#include <Arial14.h>
#include <ks0108.h>
#include <ks0108_Arduino.h>
#include <ks0108_Mega.h>
#include <ks0108_Panel.h>
#include <ks0108_Sanguino.h>
#include <SystemFont5x7.h>

// Chip specific includes
#if defined(AVR_ATmega1280)
#include "ks0108_Mega.h" // include this for the Arduino Mega other ATmega1280 boards
#elif defined(AVR_ATmega2560)
#include "ks0108_Mega.h" // include this for the Arduino Mega2560 other ATmega1280 boards
#elif defined (AVR_ATmega644) // TODO - check this define
#include "ks0108_Sanguino.h" // include this for Sanguino or ATmega644 boards
#else
#include "ks0108_Arduino.h" // include this for the Arduino or other ATmega168 boards
#endif

#include "ks0108_Panel.h" // this contains LCD panel specific configuration

// defines pins numbers
#define glcdCSEL1 33 // CS1 Bit
#define glcdCSEL2 34 // CS2 Bit
#define glcdRW 35 // R/W Bit
#define glcdDI 36 // D/I Bit
#define glcdEN 37 // EN Bit

const int trigPin = 40;
const int echoPin = 41;
const int buzzer = 49;
const int ledPin = 51;

// defines variables
long duration;
int distance;
int safetyDistance;

void setup() {
// Initialize the GLCD
GLCD.Init(INVERTED) ;

GLCD.SetFontColor( BLACK);
GLCD.ClearScreen();
GLCD.CursorToXY( 1,5);
GLCD. print("distance:") ;

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(buzzer, OUTPUT);
pinMode(ledPin, OUTPUT);

}

void loop() {

// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Calculating the distance
distance = (duration * 0.034 / 2);

safetyDistance = distance;
if (safetyDistance <= 5) {
digitalWrite(buzzer, HIGH);
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(buzzer, LOW);
digitalWrite(ledPin, LOW);
}
GLCD.CursorToXY( 1,16);
GLCD. print(distance);
}

The ks0108 library has not been maintained for many years. It will not run with any of the 1.x versions of Arduino.
See the ks0108 library page for alternative libraries:
http://playground.arduino.cc/Code/GLCDks0108
Of course my recommendation would be for openGLCD.
--- bill

thank you for your reply. what would be the best zip file to download?

Whichever you want. I'd recommend the most recent version.See the documentation in the openGLCD wiki for what is in each one.

i include the following in my codes. the compilation is successful but still there's no display in the lcd.

#include <openGLCD.h>
#include <openGLCD_Buildinfo.h>
#include <openGLCD_Config.h>

while those includes could be used without issue, not all of them are needed.
See the included html documentation and the included examples.
You should be running the diagnostic sketch to help debug the connections to the module.
The documentation shows the expected result and describes some possible issues depending on results.

--- bill

SUCCESS! thank you so much for your help :slight_smile: God bless. :slight_smile: