GLCD how to print a value to the screen

i have got my Glcd working i want to print the value of count to the screen can someone tell me what is wrong with the line


#include <ks0108.h> // library header
#include <Arial14.h> // font definition for 14 point Arial font.
#include “SystemFont5x7.h” // system font
#include “ArduinoIcon.h” // bitmap

unsigned long startMillis;
unsigned int iter = 0;

void setup(){

GLCD.Init(NON_INVERTED); // initialise the library

GLCD.SelectFont(System5x7); // select fixed width system font

void loop(){ // run over and over again

// display number of iterations in one second
GLCD.ClearScreen(); // clear the screen
GLCD.CursorTo(5,1); // positon cursor
GLCD.Puts("test1 "); // print a text string
int count = 4440;


The problem is Puts() is expecting a character array and you've passed it an integer. This is being interpreted as a pointer to a character array and won't do what's expected.

One way to solve your problem is to use sprintf() to convert the number into a string:

char numeric[10];

sprintf(numeric, "%d", count);

I've not tried to compile this, I've not got an Arduino & display handy but it should give you an idea.


thanks thats done the trick

One thing I notice is that you are not using the latest glcd v3 library.
Switch to the newer library as it has many more capabilities and is also much faster.
Here is a link to the google code page for it: Google Code Archive - Long-term storage for Google Code Project Hosting.
It includes lots of documentation in both pdf and HTML forms and many new examples
including a game.

The glcd library supports the full Print class.
Unfortunately, the Arduino guys have never documented the Print class so the
best documentation for it can be found in the Serial library.

NOTE: the Print class is not part of the serial library and is available to
any library that chooses to use it. i.e. LiquidCrystal, glcd, etc...

It is the Print class that knows about types when outputting text.
So to print a number using the Print class you would use:


A string using Print class:


Also, if you want to use printf() functions, the glcd v3 library supports it directly so you
do not need to waste the overhead of having to call sprintf() and the overhead of having
to allocate a buffer that an be overflowed.
Simply use the Printf funtion:

GLCD.Printf("%d", count);

while printf can provide great formating keep in mind that it takes up 1.8k of code space.
So depending on your application this may or may not be acceptable.
On the other hand the Print class can be a real pig as well. If you use any hex output or
any printing where you specify the base, the floating point library is dragged in which is over 1k of code.

The best thing from a code size perspective is not to mix and match between the types.
Either stick with Print class functions or with printf.

--- bill