How to make that cube do what you want it to!

I followed the instructable here and built a 3x3 LED cube run by an Arduino. I was delighted! But it could only do one routine. Again and again and again and again and again.... So I decided to try and program a different routine. I needed a change. Do you?

If you study the code in the cube's Arduino sketch you can see all the instructions right in front of you. To me, it looks like the Matrix, streaming by in all its digital confusability. I needed a graphic interface to help me code the routines. I FOUND ONE!!! But it wrote code that contained extra information that I did not want. How to rewrite all those instructions? Read on!

Be prepared, this is a twisted solution, combining an (apparently) anonymous website with a macro in my word processor, but in the end I have come up with a routine that is very powerful indeed!

Step 1: graphic pattern generator

I searched and searched for "LED Cube Programmers" on the web. I found some, but they were for PIC based cubes. I changed the title of my search to "LED Cube Pattern Generator" and BINGO! I finally found this one, and it allowed my simple mind to grasp the relationship between little flashing lights and gobs of 1's and 0's. I could punch little buttons on the screen and see a simulation of what I was doing! Just what I wanted. This generator allows one to use a cube of any size! Press the "new" button and you will be prompted to set up your cube.

'Insert' creates a new frame, just like a simple animation program. We are going to make a 'flip book,' in effect. Each page is programmed and then you hit the insert button to add another frame. Notice the speed parameter near the bottom of the window marked 'frames.' F and E mean 'Fill' and 'Erase.' Program a few frames and hit the 'Play' button. Your animation will be shown in the 'preview' window. Simple! When you are done and want to save your new light show, hit the 'File' button. You will see the buttons marked 'New',' to Code',' Load' and 'Save' appear. Press 'To Code,' and a window will open, asking you to choose in which order you wish to display your data. You can go back and change this later if you get it wrong. Just choose one for now.

You will then see a window with all your animation's coded bytes.
Hello I had build this cube a while back and everything functioned correctly but when I tried to upload the code to my cube I keep getting an error on the very last like of the code. Error goes as follows<br>Expected 'else' before '}' I have read over the code atleast 20 times and I cannot figure it out. The code is exactly the same as what is posted on this site. Any help would be greatly appreciated
<p>on the 17th line of code in your example, &quot;prog_uchar PROGMEM PatternTable[] = {&quot; Needs to be modified. &quot;prog_uchar&quot; should be &quot;const char&quot;. Im not sure what &quot;prog_uchar&quot; is for, but in the current version of Arduino firmware, it does not know what to do with that. The line of code that worked for me was &quot;const char PROGMEM PatternTable[] = {&quot;</p>
<p>rkshirsarar, </p><p>if you look at this site, designed by my friend to program these cubes, you will see the pin numbers in his setup code located in the code examples he provides. He uses these pins for his setup and it works great! </p><p>int g1=4; <br>int g2=3; <br>int g3=2 (pins 4,3,2 for the transistors, 5-13 for the anodes, as stated there)</p><p>A fantastic programming interface! Try it!! </p><p><a href="http://www.ledcube3d.tk/" rel="nofollow">http://www.ledcube3d.tk/</a></p>
<p>Could you tell which pins of Arduino are connected to transistors and which pins are connected to anode of led's, I mean the schematic of the cube.</p>
<p>If anyone tries this... you should have a look at this fantastic online programmer for 3x3x3 cubes: <a href="http://ledcube.tk" rel="nofollow"> http://ledcube.tk</a></p><p>Lots of great features, and no more need for this workaround! </p><p>Thanks Satvik for the coding and work there. You've done a great job!</p>
<p>Hy,</p><p>I want to ask u about the </p><p><a href="http://ledcube.tk" rel="nofollow">http://ledcube.tk</a> I have done the led cube and I uploaded the code from the site but I have to change something in the code to make it work something like (a1),etc.CAn u help me please?</p>
It doesn't work for 4x4x4 cube.
i have a question about the code. <br>When i want to upload it to my arduino, i get an error on line: <br>int LEDPin[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10}; <br> <br>it says: <br>sketch_jan07a:34: error: expected ',' or ';' before 'int' <br>sketch_jan07a.ino: In function 'void setup()': <br>sketch_jan07a:45: error: 'LEDPin' was not declared in this scope <br>sketch_jan07a.ino: In function 'void loop()': <br>sketch_jan07a:95: error: 'LEDPin' was not declared in this scope <br> <br>what can be the problem?
Your first error indicates a problem *before* inserting the changed lines. Check everything VERY carefully from the beginning and see if you can find a missing semicolon.
Hi, this is very interesting, but i have a question, is posible to program 2 or 3 routines and start them whit a button? thanks for afterhand
I never thought of that... why not? It is a matter of storing the routines as data, and then using a switch to select the data set, or the switch could select the starting point of the routine with case switch commands. There are others out there who are brazilians of times better at this than I am. We will have to seek the answer!!
Great able ,been looking for the led generator &amp; everytime go to Download more junk seems to be getting downloaded than the program, where did you get it Wout all the other advertisers junk..Thanks for sharing project &amp; time finding the way to go..D
I couldn't understand how to embed a video in any of the steps. Here is a link to one showing a short routine done using this method.<br><br>http://www.youtube.com/watch?v=aUib24e1Dzk

About This Instructable


54 favorites


Bio: former musician. I have made kites, music instruments, electronic doodads, pitching machines, stomp rockets, water rockets, windless windchimes, circuit bent toys, animatronics, clock escapements, CNC ... More »
More by stringstretcher: 3X3 LED Cube Programming tips (Arduino based) Simple (Deluxe!) Sonotube Food Dehydrator
Add instructable to: