Hey guys! Merry Christmas!
I'm working with one of these:
on an arduino mega, I used the output set A on these instructions:
http://www.arduino.cc/playground/Code/GLCDks0108
and I wired it according to this diagram:
I uploaded the sketch to my mega and all I get on the screen is a bunch of random horizontal lines, so what I did was put in serial.println commands to see at what point the code was failing, I found that it was stopping at :
GLCD.DrawBitmap(ArduinoIcon, 32,0, BLACK); //draw the bitmap at the given x,y position
delay(3000);
Also I notice that I cannot upload the sketch if the reset button is wired into what is labeled as the correct port (line 14 > the reset button next to the 5v+)
Any ideas from anyone? Also I've tried both the GLCD v3 RC2 and RC3 and I included #define AVR_ATmega1280 in the headers for the sketch.
EDIT: also here is my sketch code with the diagnostics, I tried commenting out the DrawBitmap command and it error'ed out at the next Draw command in the while() loop so I'm figuring it must be something to do with my wiring, also I will upload a vid of my LCD freaking out momentarily.
#include <ks0108.h> // library header
#include <Arial14.h> // font definition for 14 point Arial font.
#include "SystemFont5x7.h" // system font
#include "ArduinoIcon.h" // bitmap
#define __AVR_ATmega1280__
unsigned long startMillis;
unsigned int iter = 0;
void setup(){
Serial.begin(9600);
Serial.println("start checkpoint NEW");
GLCD.Init(NON_INVERTED); // initialise the library
Serial.println("start checkpoint 1");
GLCD.ClearScreen();
Serial.println("start checkpoint 2");
GLCD.DrawBitmap(ArduinoIcon, 32,0, BLACK); //draw the bitmap at the given x,y position
delay(3000);
Serial.println("start checkpoint 3");
GLCD.ClearScreen();
GLCD.SelectFont(System5x7); // select fixed width system font
Serial.println("start checkpoint");
}
void loop(){ // run over and over again
Serial.println("checkpoint 1");
startMillis = millis();
Serial.println("checkpoint 2");
while( millis() - startMillis < 1000){ // loop for one second
Serial.println(startMillis);
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
GLCD.CursorTo(5,5); // locate curser for printing text
GLCD.PrintNumber(++iter); // print current iteration at the current cursor position
}
Serial.println("checkpoint 3");
// display number of iterations in one second
GLCD.ClearScreen(); // clear the screen
GLCD.CursorTo(13,2); // positon cursor
GLCD.Puts("FPS= "); // print a text string
GLCD.PrintNumber(iter); // print a number
}