Intro:
For my senior project, I have built a 6X6X6 LED Light cube that is run off the Arduino Uno. I have built and designed everything myself though not without some errors. The way you see it in the videos is the final project for the class. The class is now over but I can still take this thing further and want to learn and understand the coding side even more. I will admit right now that coding is by far the hardest part of this project for me and it doesn't come naturally for me. My professor has taught and assisted me so far.
The design:
The overview idea is to run the 216 LEDs off an Arduino Uno and use 595 chips to multiply the 12 outputs into 42 outputs(36 for the pillars and 6 for the layers). There are 6 595 chips in use that each controls their own verticle plain. And each layer goes straight back to the Arduino.
Big Mistake #1:
When I started this project I got the idea from some guy off the internet. He had a 'How to' tutorial video on how to build one. I followed it and built the LED cube part before even starting on anything else. When it was prototyping the circuit board design on breadboards, I found out that this dude had a 'fatal error'/design flaw in the tutorial which was that all the LEDs were soldered backwards, which as most yall know doesn't work. Silly me. Determined to not rebuild the entire cube again I redesigned my board(working out many other kinks).
Solution:
Inverters. I inverted each output from the 595 chips.
Big Mistake #2:
I then built my first custom board. I then ran into some issues where the outputs would turn on when told to but when turned off they would either stay on, delay-off or behave perfectly. After many hours of headbanging against the wall, we discovered that each input to the 04 inverters must be grounded. If not grounded they will act as mini resistors and latch on randomly for durations of time.
Solution:
Use 10K resistors on each 04 inverter input.
Where you guys come in:
My code:
The code that I am using for the majority of the time is just turning on and offsets of LEDs for periods of time in specific orders. But there are limits to the shapes and figures that I can create with this method. For example, if I wanted to create an "o" vertically in a 3X3 manner with the center LED off I could program it but it would display as just a 3X3 verticle block. Because the pillar used to turn on the top center and bottom center LEDs and the middle plain used to turn on the middle left and right LEDs would conflict to turn on the very center LED. So the goal code is to turn on each layer individually with the desired LEDs and then switch to the next layer. By doing so you no longer are limited to the figures that can be created on the Cube.
The first program situation:
In this program, I have created multiple functions each exploring a different concept. All the code is done the 'simple way' in program0() and program1(). program2() uses the animated method(aka Draw() in my program). The code works and the figure appears as anticipated but whenever I use the Draw() function the LEDs immediately below any LED turned on are also on but about half as bright. So any shape created has like this ghosting effect only on the LEDs directly below the activated ones. I don't understand what is causing this and how(if possible) to resolve it. My best guess is that the previous layer isn't turning off quick enough and getting caught up in the next layer?!
Code will be attached as Working_code
The second program situation:
I am trying to create a raining effect program. The idea is to have the top layer completely on and one by one the LEDs fall 'randomly' to the bottom and repeat when all 36 have fallen. In the following code, I have all the 36 LEDs in the top layer 'randomly' turning off. After each LED turns off there is the following code that simulates the falling rain. The issue is that during the simulating of the falling rain the entire top layer of remaining on LEDs turn off. Then they turn on for 50ms between each raindrop then off again. It is very nauseating and what would be the best way to keep the top layer on during the raindrop animating??
Code will be attached as Rain
Any pointers, advice, and corrections are greatly appreciated. And Thanks in advance.

Rain.ino (18.2 KB)
Working_Code.ms14.ino (11.7 KB)
