Edit: there's an error: D2..D10 are
9 pins, so in fact you're only using D2..D9
Here's a 2nd revision:
// LEds on D2 to D9.
#define ARY_LEN(a) (sizeof(a)/(sizeof(a[0])))
byte ledPins[] = {
2, 3, 4, 5, 6, 7, 8, 9
};
const byte NUM_PINS = ARY_LEN(ledPins);
unsigned int HappyXmas[] = {
254,16,16,254,0,62,72,72,62,0,63,68,68,56,0,63,68,68,56,0,0,114,9,9,126,0,0,198,40,16,40,198,62,96,62,96,62,0,62,72,72,62,0,36,82,74,36,0,0,0
};
const byte NUM_ROWS = ARY_LEN(HappyXmas);
void setup() {
for (int i = 0; i < NUM_PINS; i++) {
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
}
void loop() {
for (int j = 0; j < NUM_ROWS; j++) {
int Row = HappyXmas[j];
for (int i = 0; i < NUM_PINS; i++) {
if (bitRead(Row, i)) {
digitalWrite(ledPins[i], HIGH);
}
else {
digitalWrite(ledPins[i], LOW);
}
}
delay(2);
}
delay(100);
}
Also, how is it all wired up ? The leds must be moving somehow I guess...