Step 4: Using the Software
My first decision was to make the software mirror the hardware. That meant addressing each LED by column and level instead of using raw port data or the traditional x, y, z. The second decision was to start with basic functions, like turning a single light on or off, and building up from there.
Lastly I decided to introduce two features which are useful for more interesting effects. One is a buffer which allows the basic functions to build up more complex patterns. The other is a sequence function which lights an array of LEDs one at a time, or all at once.
The library started as procedural code and loose functions. From there it was very easy to follow the tutorial to create a reusable Arduino library.
Be sure to download the library and unzip it to sketchbook/libraries. If set up correctly you should find an example in the Arduino software under File > Examples > LedCube > ledcube.
The code is also available on Github at gzip/arduino-ledcube.
Thanks for reading!
Remove these ads by
Signing Up







































Visit Our Store »
Go Pro Today »




Arduino LED Cube code
ledcube.cpp:1:21: error: LedCube.h: No such file or directory
ledcube.pde:-1: error: 'LedCube' does not name a type
ledcube.cpp: In function 'void loop()':
ledcube.pde:-1: error: 'cube' was not declared in this scope
Plz help me
Another option is to add the library to the main libraries folder (which is in the same folder as the arduino executable). It's just a less flexible location since you'll have to move any libraries that you've added there the next time you upgrade the arduino software.
Either way you should find the example under File > Examples > LedCube > ledcube if you've set everything up correctly.
http://www.youtube.com/watch?v=VH2tW6YQ-5U
I thought this instructable was the best of many concerning the building and operation of an Arduino-powered LED cube, even though it was just for 3x3x3. The 4x4x4 version is still pretty cheap and simple to build, but the other builders didn't have the great program code that gzip and bogyman57 have here. The existing code is "almost" fully ready for 4x4x4, and it's obvious that gzip and bogy wrote it with as much generality in mind as possible. I tried to make my modifications and additions with the same idea, but there are a couple places where I got lazy and hard-coded the 4 and 16 parameters or a brute-force routine. This can be easily fixed, I think, to generalize the sketch and the other files to arbitrary X x Y x Z arrays.
My cube works great with the OSEPP arduino MEGA clone. Others might have to adjust the pinout arrays in the .pde file to correspond to your cube wiring, but if you follow the instructions in this instructable and just extend in the logical manner your pinout will be the same as mine, probably.
Thanks for this great instructable and the originals of the library files!! I can really appreciate how much work went into writing those files.
Others may also need to adjust the timing variables to get the patterns to display pleasantly on your board.
The zip file of the .pde, the .cpp, and the .h files is here:
[url]http://205.196.121.50/3jbuw3i36mvg/laj2cixxb9z99hh/AlsLEDCube4x4x4Button.zip[/url]
Fun Stuff !!
--Alsetalokin
My solution was to replace the
" if (r && r < levels) "
with the code
" if ((r+1) && r < levels) "
in the "lightLevels" function in the LEDCube.cpp file, save the file, exit the Arduino IDE and restart, recompile your .pde file. Now all three levels work in the "OneLevelAtATime1" function call.
Please -- can you help to extend your code to a 4x4x4 cube !!??
yes the value would be higher then what you are using i.e 1 watt but i think that may work but i could be wrong anyway i have nearly finished my own so i will try this with a 50 Ohm POT, anyway thanks for your help.
I am also new to this and do not speak English XD
As for "LedCube does not name a type" and "LedCube.h: No such file or directory", It sounds like you still need to unzip the LedCube folder to sketchbook/libraries. Once you have that set up correctly you'll get an entry under File > Examples > LedCube > ledcube which you can open and compile without problems.
I'm playing around with the code now and I see the basic theory of how it works and now that's it all together and I'm able to tweak the code. Gonna try a 4x4x4 using 16 gauge wire to build a grid then bend the LED legs so the slide on for easier soldering and hopefully to make the thing a little more structurally solid. I saw some pictures in another LED cube guide in the comments that explained it and had pictures. My 3x3x3 cube I used a jig, but soldering the levels together I bent a few out of square so they don't all line up perfectly. Still this was totally awesome and thanks!