Hey Everyone, first time posting here!
So the title says it all. I'm in a introductory electronics course and desperately need some help with my final project. We are allowed to use any resources out there, so I'm coming to you all!
Our group is going to build a 3x3 LED cube equipped with 12 buttons to simulate the real deal. The rub is that besides from a two day Arudino workshop, I have no coding experience whatsoever. Here's where I am so far.
I know that we'll need individual control over 54 RGB LED's, which means 162 ports. In addition, we'll need 12 buttons for each possible rotation, so we're looking at ~174 ports in general. For the multiplexing, I will be using ~25 STP16C596 shift registers. I realize there are better ones out there, but this is what we're going with.
At this point, my biggest struggle is coding for this many shift registers. I have a good idea of what I need to do, but don't know how to accomplish it. To get started I've been studying the example code that came with my Arduino. It uses the shift register I am planning to use, which is basically why I chose it. I've put the code at the bottom without all of the comments.
I really like the shiftWrite function they defined, but don't know how to extend it to multiple shift registers. The function basically let's you control any port on one shift register using a function analogous to digitalWrite on the arduino.
Provided I CAN individually write to whatever port on whatever shift register I want, my plan was this:
-
Create one variable for each port on each shift register, and one variable for the status of each port that will be equal to either one or zero, (on or off).
-
Properly assign all of the variable so that the Cube will appear solved on start-up. This will require keeping track of which variables belong to which LED.
-
Write out 12 functions to be executed with push buttons. Each function will effectively swap the variables associated certain ports in order to properly change the LED's (I have written exactly what needs to be swapped for each move).
This is what I've thought out so far, and feel as if it should be able to work. Guys and Gals, I would really appreciate all the help I can get- whether it's advice on how to control multiple shift registers, or ideas for how I can solve this problem more elegantly.
Thanks you all so much