[SOLVED] Q: GLCD print - Display 5 digits

In the doc I find:
Serial.println(1.23456, 4) gives "1.2346"

I want to try to hold 5 digits, Ex. 00025

So for glcd I wrote:
GLCD.print(millis()/10000,5); 'hoping that the ,5 would hold 5 places in an attempt to get close.

Is it possible? Or is the placeholder only going to work for decimal values, ie. 0.12000 ?

There is currently a thread on the first page of this forum discussing the exact same thing.

I see this one:
http://arduino.cc/forum/index.php/topic,116861.0.html

about using serial print.

I will try to incorporate it.

Maybe inside a loop:
EDIT:

int digits = millis()/10000;
int digchk = digits;
switch (digchk) {
    case 5: { if (digchk<10000) { GLCD.print('0'); }}
    case 4: { if (digchk<1000)  { GLCD.print('00'); }}
    case 3: { if (digchk<100)   { GLCD.print('000'); }}
    case 2: { if (digchk<10)    { GLCD.print('0000'); }}
}
GLCD.print(digits);
//digchk = 0;

EDIT: Got it.

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  GLCD.CursorTo(0, 1);

  // print the number of seconds since reset:
  int digits = millis()/10000;
  int digchk = digits;
  switch (digchk) {
    case 5: { if (digchk<10000) { GLCD.print('0'); }}
    case 4: { if (digchk<1000)  { GLCD.print('00'); }}
    case 3: { if (digchk<100)   { GLCD.print('000'); }}
    case 2: { if (digchk<10)    { GLCD.print('0000'); }}
  }
  GLCD.print(digits);
}

I don't get what this means:

// set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  GLCD.CursorTo(0, 1);

There isn't a cursor on the screen. Can someone explain?
EDIT: ah ok, the second row on the screen is where text will start...

Well, I guess the terminology used in glcd may be a bit confusing.
While there is no visible cursor shown on the glcd display, there is a cursor position.
The next printed character on the glcd in the text area will be at the current
cursor position for the text area (each text area has its own "cursor" position).

Does that make sense?
You can think of glcd as having an "invisible" cursor.

One thing to take note of is that if you intend to overwrite the numbers with a new
set of numbers, you must to use a fixed width font. Otherwise even though there may
be the same number of digits printing, the overall width in pixels of all the digits
may not be the same. This is because with most proportional fonts, the digits are not
all the same width in pixels.

BTW, the glcd library supports xxprintf() formatting so if you want you can use
GLCD.Printf() to format your output strings. It will cost you about 1.5-1.8k of flash space
but it makes formatting really easy and is very easy to update/modify the formating.

i.e.

GLCD.Printf("%05d", millis()/1000); // print number of seconds since reset as 5 zero filled digits
GLCD.Printf("%5d", millis()/1000); // print number of seconds since reset as 5 right adjusted digits

should do what you wanted in your example.

See the BigNums example for other Printf examples and some examples of how
to use glcd text areas.

--- bill

Thank you for the instruction, advice, and example. I will look at them and post back. Big text. Ooooooooooo!!!

EDIT:
Thank you for the code. The switch statement I was using didn't do the job.

Thanks for the fix.