Bytes

Hi

I'm writing some code that ,at its very basic, display a custom character on an 8x8 led matrix.

I have all the characters assigned a to z, which relate to the displaying showing "25" down to "0". The character changes on a button press.

I have a int used as a button press counter in a for loop. How can I assign the byte to relate to the int value to change the display?

I know very little about bytes and how they work, but I do understand how the arrays are formed.

Character arrays:

  byte a[8] = {0x6e, 0xa8, 0x2c, 0x42, 0x82, 0xec, 0x00, 0x00};
  byte b[8] = {0x62, 0xa6, 0x2a, 0x4f, 0x82, 0xe2, 0x00, 0x00};
  byte c[8] = {0x6e, 0xa2, 0x26, 0x42, 0x82, 0xee, 0x00, 0x00};
  byte d[8] = {0x66, 0xaa, 0x22, 0x44, 0x88, 0xee, 0x00, 0x00};
  byte e[8] = {0x64, 0xac, 0x24, 0x44, 0x84, 0xee, 0x00, 0x00};
  byte f[8] = {0x66, 0xa9, 0x29, 0x49, 0x89, 0xe6, 0x00, 0x00};
  byte g[8] = {0x44, 0xca, 0x4a, 0x46, 0x42, 0xec, 0x00, 0x00};
  byte h[8] = {0x4e, 0xca, 0x4e, 0x4a, 0x4a, 0xee, 0x00, 0x00};
  byte i[8] = {0x4e, 0xc2, 0x42, 0x44, 0x48, 0xe8, 0x00, 0x00};
  byte j[8] = {0x46, 0xc8, 0x4c, 0x4a, 0x4a, 0xe4, 0x00, 0x00};
  byte k[8] = {0x4e, 0xc8, 0x4c, 0x42, 0x42, 0xec, 0x00, 0x00};
  byte l[8] = {0x4a, 0xca, 0x4a, 0x4e, 0x42, 0xe2, 0x00, 0x00};
  byte m[8] = {0x4e, 0xc2, 0x46, 0x42, 0x42, 0xee, 0x00, 0x00};
  byte n[8] = {0x4e, 0xc2, 0x4e, 0x48, 0x48, 0xee, 0x00, 0x00};
  byte o[8] = {0x44, 0xcc, 0x44, 0x44, 0x44, 0xee, 0x00, 0x00};
  byte p[8] = {0x46, 0xc9, 0x49, 0x49, 0x49, 0xe6, 0x00, 0x00};
  byte q[8] = {0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x00, 0x00};
  byte r[8] = {0x18, 0x24, 0x3c, 0x24, 0x24, 0x18, 0x00, 0x00};
  byte s[8] = {0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00};
  byte t[8] = {0x1c, 0x20, 0x38, 0x24, 0x24, 0x18, 0x00, 0x00};
  byte u[8] = {0x3c, 0x20, 0x38, 0x04, 0x04, 0x38, 0x00, 0x00};
  byte v[8] = {0x24, 0x24, 0x3c, 0x04, 0x04, 0x04, 0x00, 0x00};
  byte w[8] = {0x3c, 0x04, 0x3c, 0x04, 0x04, 0x3c, 0x00, 0x00};
  byte x[8] = {0x3c, 0x04, 0x3c, 0x20, 0x20, 0x3c, 0x00, 0x00};
  byte y[8] = {0x08, 0x18, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00};
  byte z[8] = {0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00};

I just need the value of my int to relate to byte a, byte b, byte c etc..

This is how the character is displayed:

lc.setRow(0, 0, a[0]);
  lc.setRow(0, 1, a[1]);
  lc.setRow(0, 2, a[2]);
  lc.setRow(0, 3, a[3]);
  lc.setRow(0, 4, a[4]);
  lc.setRow(0, 5, a[5]);
  lc.setRow(0, 6, a[6]);
  lc.setRow(0, 7, a[7]);

Thanks

This is how the character is displayed:

That is how the a character is displayed. You'd have 8 more lines like thatvfor the b caracter, the c character, etc.

Or you copy the letter data to another array.

At the moment I've written a short sketch to test the characters.

#include "LedControl.h"


LedControl lc = LedControl(6, 9, 10, 1);


unsigned long delaytime = 500;

void setup() {
  
  lc.shutdown(0, false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0, 8);
  /* and clear the display */
  lc.clearDisplay(0);

  
}


void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  byte a[8] = {0x6e, 0xa8, 0x2c, 0x42, 0x82, 0xec, 0x00, 0x00};
  byte b[8] = {0x62, 0xa6, 0x2a, 0x4f, 0x82, 0xe2, 0x00, 0x00};
  byte c[8] = {0x6e, 0xa2, 0x26, 0x42, 0x82, 0xee, 0x00, 0x00};
  byte d[8] = {0x66, 0xaa, 0x22, 0x44, 0x88, 0xee, 0x00, 0x00};
  byte e[8] = {0x64, 0xac, 0x24, 0x44, 0x84, 0xee, 0x00, 0x00};
  byte f[8] = {0x66, 0xa9, 0x29, 0x49, 0x89, 0xe6, 0x00, 0x00};
  byte g[8] = {0x44, 0xca, 0x4a, 0x46, 0x42, 0xec, 0x00, 0x00};
  byte h[8] = {0x4e, 0xca, 0x4e, 0x4a, 0x4a, 0xee, 0x00, 0x00};
  byte i[8] = {0x4e, 0xc2, 0x42, 0x44, 0x48, 0xe8, 0x00, 0x00};
  byte j[8] = {0x46, 0xc8, 0x4c, 0x4a, 0x4a, 0xe4, 0x00, 0x00};
  byte k[8] = {0x4e, 0xc8, 0x4c, 0x42, 0x42, 0xec, 0x00, 0x00};
  byte l[8] = {0x4a, 0xca, 0x4a, 0x4e, 0x42, 0xe2, 0x00, 0x00};
  byte m[8] = {0x4e, 0xc2, 0x46, 0x42, 0x42, 0xee, 0x00, 0x00};
  byte n[8] = {0x4e, 0xc2, 0x4e, 0x48, 0x48, 0xee, 0x00, 0x00};
  byte o[8] = {0x44, 0xcc, 0x44, 0x44, 0x44, 0xee, 0x00, 0x00};
  byte p[8] = {0x46, 0xc9, 0x49, 0x49, 0x49, 0xe6, 0x00, 0x00};
  byte q[8] = {0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x00, 0x00};
  byte r[8] = {0x18, 0x24, 0x3c, 0x24, 0x24, 0x18, 0x00, 0x00};
  byte s[8] = {0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00};
  byte t[8] = {0x1c, 0x20, 0x38, 0x24, 0x24, 0x18, 0x00, 0x00};
  byte u[8] = {0x3c, 0x20, 0x38, 0x04, 0x04, 0x38, 0x00, 0x00};
  byte v[8] = {0x24, 0x24, 0x3c, 0x04, 0x04, 0x04, 0x00, 0x00};
  byte w[8] = {0x3c, 0x04, 0x3c, 0x04, 0x04, 0x3c, 0x00, 0x00};
  byte x[8] = {0x3c, 0x04, 0x3c, 0x20, 0x20, 0x3c, 0x00, 0x00};
  byte y[8] = {0x08, 0x18, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00};
  byte z[8] = {0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00};



  /* now display them one by one with a small delay */
  lc.setRow(0, 0, a[0]);
  lc.setRow(0, 1, a[1]);
  lc.setRow(0, 2, a[2]);
  lc.setRow(0, 3, a[3]);
  lc.setRow(0, 4, a[4]);
  lc.setRow(0, 5, a[5]);
  lc.setRow(0, 6, a[6]);
  lc.setRow(0, 7, a[7]);
  delay(delaytime);
  lc.setRow(0, 0, b[0]);
  lc.setRow(0, 1, b[1]);
  lc.setRow(0, 2, b[2]);
  lc.setRow(0, 3, b[3]);
  lc.setRow(0, 4, b[4]);
  lc.setRow(0, 5, b[5]);
  lc.setRow(0, 6, b[6]);
  lc.setRow(0, 7, b[7]);
  delay(delaytime);
  lc.setRow(0, 0, c[0]);
  lc.setRow(0, 1, c[1]);
  lc.setRow(0, 2, c[2]);
  lc.setRow(0, 3, c[3]);
  lc.setRow(0, 4, c[4]);
  lc.setRow(0, 5, c[5]);
  lc.setRow(0, 6, c[6]);
  lc.setRow(0, 7, c[7]);
  delay(delaytime);
  lc.setRow(0, 0, d[0]);
  lc.setRow(0, 1, d[1]);
  lc.setRow(0, 2, d[2]);
  lc.setRow(0, 3, d[3]);
  lc.setRow(0, 4, d[4]);
  lc.setRow(0, 5, d[5]);
  lc.setRow(0, 6, d[6]);
  lc.setRow(0, 7, d[7]);;
  delay(delaytime);
  lc.setRow(0, 0, e[0]);
  lc.setRow(0, 1, e[1]);
  lc.setRow(0, 2, e[2]);
  lc.setRow(0, 3, e[3]);
  lc.setRow(0, 4, e[4]);
  lc.setRow(0, 5, e[5]);
  lc.setRow(0, 6, e[6]);
  lc.setRow(0, 7, e[7]);
  delay(delaytime);
  lc.setRow(0, 0, f[0]);
  lc.setRow(0, 1, f[1]);
  lc.setRow(0, 2, f[2]);
  lc.setRow(0, 3, f[3]);
  lc.setRow(0, 4, f[4]);
  lc.setRow(0, 5, f[5]);
  lc.setRow(0, 6, f[6]);
  lc.setRow(0, 7, f[7]);
  delay(delaytime);
  lc.setRow(0, 0, g[0]);
  lc.setRow(0, 1, g[1]);
  lc.setRow(0, 2, g[2]);
  lc.setRow(0, 3, g[3]);
  lc.setRow(0, 4, g[4]);
  lc.setRow(0, 5, g[5]);
  lc.setRow(0, 6, g[6]);
  lc.setRow(0, 7, g[7]);
  delay(delaytime);
  lc.setRow(0, 0, h[0]);
  lc.setRow(0, 1, h[1]);
  lc.setRow(0, 2, h[2]);
  lc.setRow(0, 3, h[3]);
  lc.setRow(0, 4, h[4]);
  lc.setRow(0, 5, h[5]);
  lc.setRow(0, 6, h[6]);
  lc.setRow(0, 7, h[7]);
  delay(delaytime);
  lc.setRow(0, 0, i[0]);
  lc.setRow(0, 1, i[1]);
  lc.setRow(0, 2, i[2]);
  lc.setRow(0, 3, i[3]);
  lc.setRow(0, 4, i[4]);
  lc.setRow(0, 5, i[5]);
  lc.setRow(0, 6, i[6]);
  lc.setRow(0, 7, i[7]);
  delay(delaytime);
  lc.setRow(0, 0, j[0]);
  lc.setRow(0, 1, j[1]);
  lc.setRow(0, 2, j[2]);
  lc.setRow(0, 3, j[3]);
  lc.setRow(0, 4, j[4]);
  lc.setRow(0, 5, j[5]);
  lc.setRow(0, 6, j[6]);
  lc.setRow(0, 7, j[7]);
  delay(delaytime);
  lc.setRow(0, 0, k[0]);
  lc.setRow(0, 1, k[1]);
  lc.setRow(0, 2, k[2]);
  lc.setRow(0, 3, k[3]);
  lc.setRow(0, 4, k[4]);
  lc.setRow(0, 5, k[5]);
  lc.setRow(0, 6, k[6]);
  lc.setRow(0, 7, k[7]);
  delay(delaytime);
  lc.setRow(0, 0, l[0]);
  lc.setRow(0, 1, l[1]);
  lc.setRow(0, 2, l[2]);
  lc.setRow(0, 3, l[3]);
  lc.setRow(0, 4, l[4]);
  lc.setRow(0, 5, l[5]);
  lc.setRow(0, 6, l[6]);
  lc.setRow(0, 7, l[7]);
  delay(delaytime);
  lc.setRow(0, 0, m[0]);
  lc.setRow(0, 1, m[1]);
  lc.setRow(0, 2, m[2]);
  lc.setRow(0, 3, m[3]);
  lc.setRow(0, 4, m[4]);
  lc.setRow(0, 5, m[5]);
  lc.setRow(0, 6, m[6]);
  lc.setRow(0, 7, m[7]);
  delay(delaytime);
  lc.setRow(0, 0, n[0]);
  lc.setRow(0, 1, n[1]);
  lc.setRow(0, 2, n[2]);
  lc.setRow(0, 3, n[3]);
  lc.setRow(0, 4, n[4]);
  lc.setRow(0, 5, n[5]);
  lc.setRow(0, 6, n[6]);
  lc.setRow(0, 7, n[7]);
  delay(delaytime);
  lc.setRow(0, 0, o[0]);
  lc.setRow(0, 1, o[1]);
  lc.setRow(0, 2, o[2]);
  lc.setRow(0, 3, o[3]);
  lc.setRow(0, 4, o[4]);
  lc.setRow(0, 5, o[5]);
  lc.setRow(0, 6, o[6]);
  lc.setRow(0, 7, o[7]);
  delay(delaytime);
  lc.setRow(0, 0, p[0]);
  lc.setRow(0, 1, p[1]);
  lc.setRow(0, 2, p[2]);
  lc.setRow(0, 3, p[3]);
  lc.setRow(0, 4, p[4]);
  lc.setRow(0, 5, p[5]);
  lc.setRow(0, 6, p[6]);
  lc.setRow(0, 7, p[7]);
  delay(delaytime);
  lc.setRow(0, 0, q[0]);
  lc.setRow(0, 1, q[1]);
  lc.setRow(0, 2, q[2]);
  lc.setRow(0, 3, q[3]);
  lc.setRow(0, 4, q[4]);
  lc.setRow(0, 5, q[5]);
  lc.setRow(0, 6, q[6]);
  lc.setRow(0, 7, q[7]);
  delay(delaytime);
  lc.setRow(0, 0, r[0]);
  lc.setRow(0, 1, r[1]);
  lc.setRow(0, 2, r[2]);
  lc.setRow(0, 3, r[3]);
  lc.setRow(0, 4, r[4]);
  lc.setRow(0, 5, r[5]);
  lc.setRow(0, 6, r[6]);
  lc.setRow(0, 7, r[7]);
  delay(delaytime);
  lc.setRow(0, 0, s[0]);
  lc.setRow(0, 1, s[1]);
  lc.setRow(0, 2, s[2]);
  lc.setRow(0, 3, s[3]);
  lc.setRow(0, 4, s[4]);
  lc.setRow(0, 5, s[5]);
  lc.setRow(0, 6, s[6]);
  lc.setRow(0, 7, s[7]);
  delay(delaytime);
  lc.setRow(0, 0, t[0]);
  lc.setRow(0, 1, t[1]);
  lc.setRow(0, 2, t[2]);
  lc.setRow(0, 3, t[3]);
  lc.setRow(0, 4, t[4]);
  lc.setRow(0, 5, t[5]);
  lc.setRow(0, 6, t[6]);
  lc.setRow(0, 7, t[7]);
  delay(delaytime);
  lc.setRow(0, 0, u[0]);
  lc.setRow(0, 1, u[1]);
  lc.setRow(0, 2, u[2]);
  lc.setRow(0, 3, u[3]);
  lc.setRow(0, 4, u[4]);
  lc.setRow(0, 5, u[5]);
  lc.setRow(0, 6, u[6]);
  lc.setRow(0, 7, u[7]);
  delay(delaytime);
  lc.setRow(0, 0, v[0]);
  lc.setRow(0, 1, v[1]);
  lc.setRow(0, 2, v[2]);
  lc.setRow(0, 3, v[3]);
  lc.setRow(0, 4, v[4]);
  lc.setRow(0, 5, v[5]);
  lc.setRow(0, 6, v[6]);
  lc.setRow(0, 7, v[7]);
  delay(delaytime);
  lc.setRow(0, 0, w[0]);
  lc.setRow(0, 1, w[1]);
  lc.setRow(0, 2, w[2]);
  lc.setRow(0, 3, w[3]);
  lc.setRow(0, 4, w[4]);
  lc.setRow(0, 5, w[5]);
  lc.setRow(0, 6, w[6]);
  lc.setRow(0, 7, w[7]);
  delay(delaytime);
  lc.setRow(0, 0, x[0]);
  lc.setRow(0, 1, x[1]);
  lc.setRow(0, 2, x[2]);
  lc.setRow(0, 3, x[3]);
  lc.setRow(0, 4, x[4]);
  lc.setRow(0, 5, x[5]);
  lc.setRow(0, 6, x[6]);
  lc.setRow(0, 7, x[7]);
  delay(delaytime);
  lc.setRow(0, 0, y[0]);
  lc.setRow(0, 1, y[1]);
  lc.setRow(0, 2, y[2]);
  lc.setRow(0, 3, y[3]);
  lc.setRow(0, 4, y[4]);
  lc.setRow(0, 5, y[5]);
  lc.setRow(0, 6, y[6]);
  lc.setRow(0, 7, y[7]);
  delay(delaytime);
  lc.setRow(0, 0, z[0]);
  lc.setRow(0, 1, z[1]);
  lc.setRow(0, 2, z[2]);
  lc.setRow(0, 3, z[3]);
  lc.setRow(0, 4, z[4]);
  lc.setRow(0, 5, z[5]);
  lc.setRow(0, 6, z[6]);
  lc.setRow(0, 7, z[7]);
  delay(delaytime);
  delay(1000);

}

That works just fine. But how do I call each byte from a for loop. As the loop counts from 25 to 0?

Display character "a"
Wait for button press
Decrease counter by one
Display character "b"

And so on

Would it be easier to call a function that relates to that character based on the value of the variable? If so how?

Probably something simple, but its getting late here and I'm missing something.

If (since?) the compiler is not checking array bounds, you could probably use this in a loop. Untested. Undoubtedly not the best way to do it.

lc.setRow(0, column, a[character*8]);

edit - where character is = 0 to 25, the number of letters minus one. If you want to use ASCII you can subtract 'a' from character.

aarg:
If (since?) the compiler is not checking array bounds, you could probably use this in a loop. Untested. Undoubtedly not the best way to do it.

lc.setRow(0, column, a[character*8]);

edit - where character is = 0 to 25, the number of letters minus one. If you want to use ASCII you can subtract 'a' from character.

Never recommend this.

There is nothing to stop you from defining a 2D array, and iterating through it, 8 rows at a time.

From what I've read, something like this might work:

  byte a[26][8] = {{0x6e, 0xa8, 0x2c, 0x42, 0x82, 0xec, 0x00, 0x00}, // 25
                   {0x62, 0xa6, 0x2a, 0x4f, 0x82, 0xe2, 0x00, 0x00},
                   {0x6e, 0xa2, 0x26, 0x42, 0x82, 0xee, 0x00, 0x00},
                   {0x66, 0xaa, 0x22, 0x44, 0x88, 0xee, 0x00, 0x00},
                   {0x64, 0xac, 0x24, 0x44, 0x84, 0xee, 0x00, 0x00},
                   {0x66, 0xa9, 0x29, 0x49, 0x89, 0xe6, 0x00, 0x00}, // 20
                   {0x44, 0xca, 0x4a, 0x46, 0x42, 0xec, 0x00, 0x00},
                   {0x4e, 0xca, 0x4e, 0x4a, 0x4a, 0xee, 0x00, 0x00},
                   {0x4e, 0xc2, 0x42, 0x44, 0x48, 0xe8, 0x00, 0x00},
                   {0x46, 0xc8, 0x4c, 0x4a, 0x4a, 0xe4, 0x00, 0x00},
                   {0x4e, 0xc8, 0x4c, 0x42, 0x42, 0xec, 0x00, 0x00}, // 15
                   {0x4a, 0xca, 0x4a, 0x4e, 0x42, 0xe2, 0x00, 0x00},
                   {0x4e, 0xc2, 0x46, 0x42, 0x42, 0xee, 0x00, 0x00},
                   {0x4e, 0xc2, 0x4e, 0x48, 0x48, 0xee, 0x00, 0x00},
                   {0x44, 0xcc, 0x44, 0x44, 0x44, 0xee, 0x00, 0x00},
                   {0x46, 0xc9, 0x49, 0x49, 0x49, 0xe6, 0x00, 0x00}, // 10
                   {0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x00, 0x00},
                   {0x18, 0x24, 0x3c, 0x24, 0x24, 0x18, 0x00, 0x00},
                   {0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00},
                   {0x1c, 0x20, 0x38, 0x24, 0x24, 0x18, 0x00, 0x00},
                   {0x3c, 0x20, 0x38, 0x04, 0x04, 0x38, 0x00, 0x00}, //  5
                   {0x24, 0x24, 0x3c, 0x04, 0x04, 0x04, 0x00, 0x00},
                   {0x3c, 0x04, 0x3c, 0x04, 0x04, 0x3c, 0x00, 0x00},
                   {0x3c, 0x04, 0x3c, 0x20, 0x20, 0x3c, 0x00, 0x00},
                   {0x08, 0x18, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00},
                   {0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00}}; // 0

and for the display:

  lc.setRow(0, 0, a[n][0]);
  lc.setRow(0, 1, a[n][1]);
  lc.setRow(0, 2, a[n][2]);
  lc.setRow(0, 3, a[n][3]);
  lc.setRow(0, 4, a[n][4]);
  lc.setRow(0, 5, a[n][5]);
  lc.setRow(0, 6, a[n][6]);
  lc.setRow(0, 7, a[n][7]);

where you would change n to 0, 1, 2, ... etc., up to 25.

Even this isn't very good. Better would be for you to reverse the array so that the actual number displayed would equal the value of n. Like so:

  byte a[26][8] = {{0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00}, //  0
                   {0x08, 0x18, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00},
                   {0x3c, 0x04, 0x3c, 0x20, 0x20, 0x3c, 0x00, 0x00},
                   {0x3c, 0x04, 0x3c, 0x04, 0x04, 0x3c, 0x00, 0x00},
                   {0x24, 0x24, 0x3c, 0x04, 0x04, 0x04, 0x00, 0x00},
                   {0x3c, 0x20, 0x38, 0x04, 0x04, 0x38, 0x00, 0x00}, //  5
                   {0x1c, 0x20, 0x38, 0x24, 0x24, 0x18, 0x00, 0x00},
                   {0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00},
                   {0x18, 0x24, 0x3c, 0x24, 0x24, 0x18, 0x00, 0x00},
                   {0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x00, 0x00},
                   {0x46, 0xc9, 0x49, 0x49, 0x49, 0xe6, 0x00, 0x00}, // 10
                   {0x44, 0xcc, 0x44, 0x44, 0x44, 0xee, 0x00, 0x00},
                   {0x4e, 0xc2, 0x4e, 0x48, 0x48, 0xee, 0x00, 0x00},
                   {0x4e, 0xc2, 0x46, 0x42, 0x42, 0xee, 0x00, 0x00},
                   {0x4a, 0xca, 0x4a, 0x4e, 0x42, 0xe2, 0x00, 0x00},
                   {0x4e, 0xc8, 0x4c, 0x42, 0x42, 0xec, 0x00, 0x00}, // 15
                   {0x46, 0xc8, 0x4c, 0x4a, 0x4a, 0xe4, 0x00, 0x00},
                   {0x4e, 0xc2, 0x42, 0x44, 0x48, 0xe8, 0x00, 0x00},
                   {0x4e, 0xca, 0x4e, 0x4a, 0x4a, 0xee, 0x00, 0x00},
                   {0x44, 0xca, 0x4a, 0x46, 0x42, 0xec, 0x00, 0x00},
                   {0x66, 0xa9, 0x29, 0x49, 0x89, 0xe6, 0x00, 0x00}, // 20
                   {0x64, 0xac, 0x24, 0x44, 0x84, 0xee, 0x00, 0x00},
                   {0x66, 0xaa, 0x22, 0x44, 0x88, 0xee, 0x00, 0x00},
                   {0x6e, 0xa2, 0x26, 0x42, 0x82, 0xee, 0x00, 0x00},
                   {0x62, 0xa6, 0x2a, 0x4f, 0x82, 0xe2, 0x00, 0x00},
                   {0x6e, 0xa8, 0x2c, 0x42, 0x82, 0xec, 0x00, 0x00}}; // 25

That makes sense odometer.

I'll try it tomorrow and let you know how I get on.

Thanks for your help so far guys

Is there a reason you want to count down instead of up?
And why are you starting from 25?

Next step is to put the table into PROGMEM instead of RAM.

odometer

Its a shot counter for a belt fed Nerf gun. Each belt has 25 shots. Eventually it will have 100 shots thats why it counts down.

The problem that now has is that I have to make a character set for 100 characters. I found a sketch that looks to use arrays of characters 0-9 and sends each character to different columns in a 5x3 pattern, thus acheiving 0-9 in columns 1-3 and 0-9 in columns 5-7. The down side is the site is in German.

I'm going to try your suggestion first so I can grab the basics and implement it in my own sketch before going further.

GoForSmoke

I've seen PROGMEM used in the sketch I noted above. I'll look into that when I got this working

The problem that now has is that I have to make a character set for 100 characters.

Surely you only need a character set for ten digits?

Eventually yes AWOL. As I said in my previous post, I found a sketch that does just that, I just want to work with what I've done so far with the advice offered here, and move on to that when I get a better understanding of how it works.

Isn't it likely you'll run out of memory if you define bit patterns for all numbers 0 - 100?

Quite possibly. Again, I'll stick to 0-25 to gain the basic knowledge then progress.

Surely this is a better way to learn, rather than ask someone to write the whole sketch for you? Unless you're offering?

Odometer - Thanks that works a treat.

I'll now work on the 10 character set and look at PROGMEM.

Cheers for your help