### LED Cube

Keaton Zonca and Cecilia DeBoever
4 x 4 x 4 LED Cube

This project is a simple LED cube. We soldered together 64 LEDs in order to create this. The LEDs can be programmed to light up in various ways. We have currently programmed it so the lights can all be one at one time or they can light up one by one in order.

 ```// This program controls our 4x4x4 LED cube. It first cycles through all the LEDs, repeats it faster, flashes all the LEDs, goes laye by layer, cycles through them again, and flashes one last time before repeating. int pos[] = {   16,17,18,19,1,0,14,15,5,4,3,   2,9,8,7,6,16,17,18,19,1,0,14,   15,5,4,3,2,9,8,7,6,16,17,18,   19,1,0,14,15,5,4,3,2,9,8,7,6,   16,17,18,19,1,0,14,15,5,4,3,2,9,8,7,6}; int neg[] = {   10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,   11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,   12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,   13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}; void setup() // run once, when the sketch starts {   for(int i=0; i<64; i++) //sets all 64 LEDs as inputs   {     pinMode(pos[i], INPUT);     pinMode(neg[i], INPUT);   } } void loop() // run over and over again {   sequence(300);   //cycles through all the LEDs at pace 300   sequence(100);   //cycles through all the LEDs at pace 100   all();           //turns on all the LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   delay(500); // delays for 500ms   all();           //turns on all the LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   delay(500); // delays for 500ms   all();           //turns on all the LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   layerone();      // turns on layer one of LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   layertwo();      // turns on layer two of LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   layerthree();    // turns on layer three of LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   layerfour();     // turns on layer four of LEDs   delay(1000); // delays for 1000ms   input();         // sets all LEDs as inputs   sequence(100);   //cycles through all the LEDs at pace 100   all();           //turns on all the LEDs   delay(1000); // delays for 1000ms   layerone();       // turns on layer one of LEDs   delay(1000); // delays for 1000ms   layertwo();       // turns on layer two of LEDs   delay(1000); // delays for 1000ms   layerthree();     // turns on layer three of LEDs   delay(1000); // delays for 1000ms   layerfour();      // turns on layer four of LEDs   delay(1000); // delays for 1000ms   input();          // sets all LEDs as inputs   all();            //turns on all the LEDs   delay(1000); // delays for 1000ms   input();          // sets all LEDs as inputs } void sequence(int pace) //cycles through all the LEDs at pace {   for(int i=0; i<64; i++) // declares i and test if less than 64, and then does the following   {      pinMode(pos[i], OUTPUT); // sets positive i as output     pinMode(neg[i], OUTPUT); // sets negative i as output     digitalWrite (pos[i], HIGH); // turns positive i on     digitalWrite (neg[i], LOW); // turns negative i on     delay(pace); // delays for pace     pinMode(pos[i], INPUT); // sets positive i as input     pinMode(neg[i], INPUT); // sets negative i as input   } } void input() // sets all LEDs as inputs {   for(int i=0; i<64; i++) //sets all 64 LEDs as inputs   {     pinMode(pos[i], INPUT);     pinMode(neg[i], INPUT);   } } void layerone() // turns on layer one of LEDs {   for(int i=0; i<16; i++) // declares i and test if less than 16, and then does the following   {     pinMode(pos[i], OUTPUT); // sets positive i as output     pinMode(10, OUTPUT); // sets pin 10 as output     digitalWrite (pos[i], HIGH); // turns positive i on     digitalWrite (10, LOW); // turns pin 10 on   } } void layertwo() // turns on layer two of LEDs {   for(int i=0; i<64; i++) // declares i and test if less than 64, and then does the following   {     pinMode(pos[i], OUTPUT); // sets positive i as output     pinMode(11, OUTPUT); // sets pin 11 as output     digitalWrite(pos[i], HIGH); // turns positive i on     digitalWrite(11, LOW); // turns pin 11 on   } } void layerthree() // turns on layer three of LEDs {   for(int i=0; i<64; i++) // declares i and test if less than 64, and then does the following   {     pinMode(pos[i], OUTPUT); // sets positive i as output     pinMode(12, OUTPUT); // sets pin 12 as output     digitalWrite(pos[i], HIGH); // turns positive i on     digitalWrite(12, LOW); // turns pin 12 on   } } void layerfour() // turns on layer four of LEDs {   for(int i=0; i<64; i++) // declares i and test if less than 64, and then does the following   {     pinMode(pos[i], OUTPUT); // sets positive i as output     pinMode(13, OUTPUT); // sets pin 13 as output     digitalWrite(pos[i], HIGH); // turns positive i on     digitalWrite(13, LOW); // turns pin 13 on   } } void all() //turns on all the LEDs {   for(int i=0; i<64; i++) // declares i and test if less than 64, and then does the following   {     pinMode(pos[i], OUTPUT); // sets positive i as output     pinMode(neg[i], OUTPUT); // sets negative i as output     digitalWrite(pos[i], HIGH); // turns positive i on     digitalWrite(neg[i], LOW); // turns negative i on   } } ```