Ik heb een sketch gevonden in Arduino COOK BOOK Pag 349
Nu is het orgineel voor een LCD 1602 display ,16,4 dus 4 regels
ik heb een 1602 2 regels.
Deze orginele sketch telt maar door ook na 9999,en dan word hij erg traag.
Nu wil ik het zo,dat als hij bij 9999 is weer naar 0 gaat tellen,of naar het begin van sketch
Nou ben ik al mooie tijd bezig ,en wat ik ook doe, het wil niet zo wat ik wil.
Het lijkt simpel ,maar is het blijkbaar niet.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte glyphs[5][8] = {
 { B11111,B11111,B00000,B00000,B00000,B00000,B00000,B00000 } ,
 { B00000,B00000,B00000,B00000,B00000,B00000,B11111,B11111 } ,
 { B11111,B11111,B00000,B00000,B00000,B00000,B11111,B11111 } ,
 { B11111,B11111,B11111,B11111,B11111,B11111,B11111,B11111 } ,
 { B00000,B00000,B00000,B00000,B00000,B01110,B01110,B01110 } };
const int digitWidth = 3; // the width in characters of a big digit (excludes
//arrays to index into custom characters that will comprise the big numbers
// digits 0 - 4Â Â Â Â Â Â Â Â Â Â Â Â Â Â 0Â Â Â 1Â Â Â 2Â Â Â 3Â Â Â 4
const char bigDigitsTop[10][digitWidth]={ 3,0,3, 0,3,32, 2,2,3, 0,2,3, 3,1,3,
// digits 5-9Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 5Â Â Â 6Â Â Â 7Â Â Â Â 8Â Â Â 9
                     3,2,2, 3,2,2, 0,0,3, 3,2,3, 3,2,3};
const char bigDigitsBot[10][ digitWidth]={ 3,1,3, 1,3,1, 3,1,1, 1,1,3, 32,32,3,
                     1,1,3, 3,1,3, 32,32,3, 3,1,3, 1,1,3};
char buffer[12]; // used to convert a number into a string
void setup ()
{
 lcd.begin(16,2);
 // create the custom glyphs
 for(int i=0; i < 5; i++)
  lcd.createChar(i, glyphs[i]); // create the 5 custom glyphs
 // show a countdown timer
 for(int digit = 9; digit >= 0; digit--)
 {
  showDigit(digit, 2); // show the digit
  delay(1000);
 }
 lcd.clear();
}
void loop ()
{
 // now show the number of seconds since the sketch started
 int number = millis() / 1000;
 showNumber( number, 0);
 delay(1000);
}
void showDigit(int digit, int position)
{
 lcd.setCursor(position * (digitWidth + 1), 0);
 for(int i=0; i < digitWidth; i++)
   lcd.print(bigDigitsTop[digit][i]);
 lcd.setCursor(position * (digitWidth + 1), 1);
 for(int i=0; i < digitWidth; i++)
   lcd.print(bigDigitsBot[digit][i]);
}
void showNumber(int value, int position)
{
int index; // index to the digit being printed, 0 is the leftmost digit
  itoa(value, buffer, 10); // see Recipe 2.8 for more on using itoa
  // dislay each digit in sequence
  for(index = 0; index < 10; index++) // display up to ten digits
  {
   char c = buffer[index];
   if( c == 0) // check for null (not the same as '0')
    return; // the end of string character is a null, see Chapter 2
   c = c - 48; // convert ascii value to a numeric value (see Recipe 2.9)
   showDigit(c, position + index);
  }
}
en zo zien de cijfers eruit op display