Author: Pat McMahon

/* 100 LED light bar using Multiplexing
* 14/2/2020 Pat McMahon.
* POSITIVES(+) 0-Orange,1-Pink,2-Brown,3-White,4-Purple,5-Blue,6-Yellow,7-Red,8-Green,9-Grey, select group - anodes
* NEGATIVES(-) 10-Blue,11-REd,12-White,13-Yellow,A0-Purple,A1-Green,A2-Pink,A3-Brown,A4-Grey,A5-Orange, select group - cathodes
* to light an LED, anode must be high, but cathode must be low
*/
int groups[] = {0,1,2,3,4,5,6,7,8,9 }; // POSITIVES
int indexes[] = {10,11,12,13,A0,A1,A2,A3,A4,A5,A6 }; // NEGATIVES
int delayTime=100;
// the setup function runs once when you press reset or power the board
void setup() {
// initialise 100 outputs for 10 x 10 matrix
// loop over the pin arrays and set them all to output
// also set all LOW
for (int thisLed = 0; thisLed < 101; thisLed++) {
pinMode(groups[thisLed], OUTPUT);
digitalWrite(groups[thisLed], LOW); // turn anodes off
pinMode(indexes[thisLed], OUTPUT);
digitalWrite(indexes[thisLed], LOW); // turn cathodes off
}
}
// the loop function runs over and over again forever
void loop() {
for (int group = 0; group < 10; group++) { // cycle through groups of 10
digitalWrite(group, HIGH); // enable cathode
for (int index = 10; index < A6; index++) { // step through each group
digitalWrite(index, LOW); // enable anode
delay(delayTime);
digitalWrite(index, HIGH); // turn anode off
}
digitalWrite(group, LOW); // disable this group
}
}