Step 6: ADD on

Picture of ADD on
so to program the cube all you need to do is change the 

B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, 80,

each B1111 corresponds to a line of LEDs in your cube 0 being off and 1 being on. The last number is the time it will display that part in milliseconds.

so get programing and enjoy.

is there away of using the random number command to make paterns

WGY2 years ago
I made my cube and all of the lights work, however, there seems to be a problem with the wiring. Whenever I address a single LED in 6 of the columns, The whole column lights up. This does not happen in 2 columns where the LED's light up individually.
Help would be appreciated!
ajvdmeij3 years ago
I have just built the cube and it is working great. You can see it here: http://www.youtube.com/watch?v=TwlSijShbbc 

Making the code for great patterns is kind of difficult, so I made a little Javascript program to make designing them more easily. It basically works as follows. You see four squares: the first square is the front layer, the second, the one behind that, the third the one behind that and the last is the back layer. You can set the LEDS on or off and when you have made a pattern, and have set a time in a text box, you can write it to a text area. Then make another one, and another one and.. When you are finished, you can copy the contents of the text area and paste it in the Arduino Code. Then go for it!

Try it here: http://home.kpn.nl/ajvdmeij/makecode.html. If you want the source code, you can copy it or tell me and i will mail it to you.

Have fun!

That is awesome!!! So handy. Thanks!
Any chance you could whip up a similar program but for an 8x8x8 cube?
fryddog3 years ago
I have made an 8x8x8 led cube already and I am trying to find an easy way to program it. Is it possible to use your code and adapt it to an 8x8x8 cube? If so would you know where to change it?
I'm brand new with arduino and i was curious to how you would upload the code on to it? any help will be appreciated. Also great work.
- Thanks
First, you have to download arduino software from arduino.cc. There will be a manual for installing drivers. After you have done that, open arduino program, write code, comply and upload to board!
alsetalokin3 years ago
Well, I built a cube (from a different instructable) and uploaded the .pde, and it runs, and appears to make the correct patterns, I think... but I can't make heads or tails out of the pattern making strings. There are some weird brightness variations too.

There are sixteen "B0000" groups per line. One would think that each group corresponds to a vertical column, and the 0s and 1s indicate the plane, and whether the light is on or off.

But that's not how it seems to work for me, and I can't figure it out.

The java applet on makecode.html always prints the same line, sixteen B1111s, no matter what boxes I have checked. The only thing that changes is the duration number, which does correspond to what I enter in the box. But everything else is always B1111s.

Can you please help me understand the pattern strings?
I tried it in Safari and Chrome on a Mac and they work. I just saw that it didn't work in Firefox. I also tried it in Windows: IE also didn't seem to work. But Safari for Windows does the trick and I think )although I did't try) that Chrome will also work on a Windows computer.

I made the code in Dreamweaver and I will try to make it Cross-platform compatible but I can't promise anything: I am just an amateur!
Can anyone provide a link to the source code? Also does the cube have to be set up a certain way? Thanks in advance.
the seaker4 years ago
so basically what you're saying is this
B1111(column1), B1111(column2), B1111(column3), B1111(column4), B1111(column5), B1111(column6), B1111(column7), B1111(column8), B1111(column9), B1111(column10), B1111(column11), B1111(column12), B1111(column13), B1111(column14), B1111(column15), B1111(column16), 80(time)

is how the code is set up?
this is a great instructable. simple and educational.
In my cube I use decoders and a bit of bitwise black magic:

* Displays the anode column with the given number value; [0, 24].
void displayNum(int num){
//constrain the argument to be between 0 and 24 inclusive.
num = constrain(num, 0, 24);

* AND: selects the bit, the bit at weight will be 1 if the pin is to be high
* >>: shifts the selected bit to the end of the word, making the value a 0 or 1
* first result is lsb
* digitalWrite: write the approptiate result (HIGH or LOW)
* to the appropriate decoder pin
for(int weight=1, pin=0; pin < DECODER_BITS; weight*=2, pin++)
digitalWrite(decoderPins[pin] ,(num & weight) >> pin);

//delay, this is the absoloute minimum time the light will be displayed.
//ensures adequate delay for decoders as well.

check it out at: http://www.instructables.com/id/LED-Cube-with-Arduino-and-custom-PCB/