# Light Show

Anthony Azzi, Justin Larson, Sean Gibson, and Joshua Becker

We made a light show using a 5 x 7 matrix LED and two breadboards.

There were a few problems encountered. While making arrays we accidentally fried three Arduino boards by going over the arrays. We also forget to save our program before Winter Vacation so we lost about a week's work and had to redo it all.

If we had more time and money we would learn how to program and use an LED matrix cube. We would also have liked to learn how to use LEDs as light sensors. We wanted to create a game but ran out of time.

Our code first sets all used pins as inputs. It then lights up the selected row/column LED by LED. The pattern that we designed is the illusion of a red light travelling around the matrix LED in a square fashion and then returning. It will repeat this pattern forever. The code for any column or row begins by setting the arrays as outputs. It then turns on the arrays and then turns them off. There is a delay, or given amount of time, and then the arrays are again set as inputs.

The following code was composed on Arduino.

int positive[] = {

13,13,13,13,13,13,13,3,3,3,3,3,3,3,4,4,4,4,4,4,4,10,10,10,10,10,10,10,6,6,6,6,6,6,6}; //declares array

int negative[] = {

2,7,1,5,8,12,9,2,7,1,5,8,12,9,2,7,1,5,8,12,9,2,7,1,5,8,12,9,2,7,1,5,8,12,9}; //

int wacka_flocka =

{

{0,1,2,3,4,5,6}, //shows 2-dimensional array

{7,8,9,10,11,12,13},

{14,15,16,17,18,19,20},

{21,22,23,24,25,26,27},

{28,29,30,31,32,33,34},

};

void setup ()

{

pinMode(1, INPUT); //sets pin as input

pinMode(2, INPUT); //

pinMode(3, INPUT); //

pinMode(4, INPUT); //

pinMode(5, INPUT); //

pinMode(6, INPUT); //

pinMode(7, INPUT); //

pinMode(8, INPUT); //

pinMode(9, INPUT); //

pinMode(10, INPUT); //

pinMode(12, INPUT); //

pinMode(13, INPUT); //

}

void loop ()

{

column(0); //tells which row/column to turn on

row(4) ; //

column2(6); //

row2(0); //

row(0); //

column(6); //

row2(4); //

column2(0); //

}

void row(int rowNum)

{

for(int o=0; o<7; o++) //cycles through and then resets

{

pinMode(positive[wacka_flocka[rowNum][o]], OUTPUT); //sets array as output

pinMode(negative[wacka_flocka[rowNum][o]], OUTPUT); //

digitalWrite(positive[wacka_flocka[rowNum][o]],HIGH); //turns on array

digitalWrite(negative[wacka_flocka[rowNum][o]],LOW); // turns off array

delay(100); //wait 100 milliseconds

pinMode(positive[wacka_flocka[rowNum][o]],INPUT); //sets array as input

pinMode(negative[wacka_flocka[rowNum][o]],INPUT); //

}

}

void row2(int rowNum)

{

for(int o=6; o>=0; o--) //cycles through and then resets

{

pinMode(positive[wacka_flocka[rowNum][o]], OUTPUT); //sets array as output

pinMode(negative[wacka_flocka[rowNum][o]], OUTPUT); //

digitalWrite(positive[wacka_flocka[rowNum][o]],HIGH); //turns on array

digitalWrite(negative[wacka_flocka[rowNum][o]],LOW); // turns off array

delay(100); //wait 100 milliseconds

pinMode(positive[wacka_flocka[rowNum][o]],INPUT); //sets array as input

pinMode(negative[wacka_flocka[rowNum][o]],INPUT); //

}

}

void column(int columnNum)

{

for(int o=0; o<5; o++) //cycles through and then resets

{

pinMode(positive[wacka_flocka[o][columnNum]], OUTPUT); //sets array as output

pinMode(negative[wacka_flocka[o][columnNum]], OUTPUT); //

digitalWrite(positive[wacka_flocka[o][columnNum]],HIGH); //turns on array

digitalWrite(negative[wacka_flocka[o][columnNum]],LOW); // turns off array

delay(100); //wait 100 milliseconds

pinMode(positive[wacka_flocka[o][columnNum]],INPUT); //sets array as input

pinMode(negative[wacka_flocka[o][columnNum]],INPUT); //

}

}

void column2(int columnNum)

{

for(int o=4; o>=0; o--) //cycles through and then resets

{

pinMode(positive[wacka_flocka[o][columnNum]], OUTPUT); //sets array as output

pinMode(negative[wacka_flocka[o][columnNum]], OUTPUT); //

digitalWrite(positive[wacka_flocka[o][columnNum]],HIGH); //turns on array

digitalWrite(negative[wacka_flocka[o][columnNum]],LOW); // turns off array

delay(100); //wait 100 milliseconds

pinMode(positive[wacka_flocka[o][columnNum]],INPUT); //sets array as input

pinMode(negative[wacka_flocka[o][columnNum]],INPUT); //

}

}   