Neopixel Display Numbers

I bought some 16 bit 4x4 neopixel (ws2812) boards from ebay and soldered them together so i have a 4x8 matrix display. I made a function pixeldisplay(digit,number,red,green,blue) to display a number easy in any color.

Of course you can extend the number with more characters just bij extending the numbers array. Keep in mind that the pixels are lit starts in the bottom left corner and like a snake move to the bottom right corner of each 4x4 grid.
! And be sure to end the number sequens for each character alsway with -1



Rightclick to see full picture Rightclick to see full picture











simple_neopixel_demo_numbers.ino

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 2

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 64

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int number[][32] ={ {2, 3, 6, 9, 12, 13, 16, 17, 18, 20, 27, 29, 30, 31, -1}, // 0
{6, 9, 10, 11, 14, 21, 24, 25, 26, 27, -1}, // 1
{1, 2, 4, 6, 9, 13, 14, 18, 20, 24, 27, 29, 30, -1} , // 2
{2, 6, 9, 12, 13, 18, 20, 24, 27, 29, 30, -1}, // 3
{28, 29, 30, 31, 19, 18, 17, 16, 23, 24, 12, 13, 14, -1}, // 4
{19, 20, 27, 28, 29, 18, 17, 16, 23, 24, 12, 13, 9, 6, 1, -1}, // 5
{6, 9, 2, 13, 3, 12, 16, 23, 24, 17, 18, 20, 27, 29, -1}, // 6
{4, 5, 6, 23, 27, 29, 25, 28, 19, 20, -1}, // 7
{2, 3, 6, 9, 12, 13, 17, 18, 23, 24, 20, 27, 29 ,30, -1}, // 8
{2, 6, 9, 12, 13, 17, 18, 23, 24, 20, 27, 29 ,30, 31, -1} // 9
};

int delayval = 1000; // delay for 1 seconds
int color1 = 60; //Red
int color2 = 20; //Green
int color3 = 0; //Blue

void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code

pixels.begin(); // This initializes the NeoPixel library.
}


boolean pixeldisplay(int digit,int num, int red, int grn, int blue) {
if (digit<0 or digit>6 or num<0 or num>9) {return false;}
for (int j = 0; j < 32; j++){
int pixelnum = number[num][j];
if (pixelnum == -1) break;
pixelnum = pixelnum + (digit*32);
pixels.setPixelColor(pixelnum, pixels.Color(red,grn,blue));
}
pixels.show(); // This sends the updated pixel color to the hardware.
}


void loop() {

for (int counter = 0; counter < 100; counter++){

int digit1 = (counter%10);
int digit0 = (counter/10);


pixeldisplay(0,digit0,color1,color2,color3);
pixeldisplay(1,digit1,color1,color2,color3);

delay(delayval);


//clearscreen
//for(int i=0;i<NUMPIXELS;i++){
// pixels.setPixelColor(i, pixels.Color(0,0,0)); // Moderately bright green color.
// pixels.show(); // This sends the updated pixel color to the hardware.
// }

pixeldisplay(0,digit0,0,0,0); //Make them black again ...
pixeldisplay(1,digit1,0,0,0); //This methods makes clearing pixels faster.



}
}