# LED CUBE CODE GENERATOR 4x4x4 Arduino

71,494

446

101

Posted

## Introduction: LED CUBE CODE GENERATOR 4x4x4 Arduino

This is a tutorial on how to easier make patterns for your Arduino-controlled LED cube 4x4x4.

I recognized the difficulty a lot of people have with programming the LED cube after building it, so I have made a program to make this an easy task.

The program will work for those that used a Arduino to control their LED cube. I did not write the LED cube code and the person I got it from didn't either so I don't know who wrote it, but thanks!

I will talk a little about how I wired the cube and how the program works in the next steps!

## Step 1: The LED Cube Code Generator

The program is made for Windows so it will not work on Apple computers unless you have a virtual windows.

How you wired your Arduino to the cube is of course very important for this to work like it's supposed to, it is a description of the pins in the Arduino code but I will also explain this in the next step.

How the code generator program works:

There are 4 squares with checkboxes. These squares are called plane 1, 2, 3 and 4. The planes represents the cube like you would have seen it if you looked straight at it from the front, so these are the four vertical planes of the cube. This is so it is easier to visualize your patterns when you make them. If you did not understand the planes you can take a look at the pictures, I will post one there to clear it up

To make a pattern you would simply check the boxes representing the LED's you want to light up and you hit the "Generate" button. Now you will see a line of code being published in the textbox below. If you want the code to be faster or slower you can enter a certain time in the "Enter time in m/s" box before generating the code, or change it later with the "Change generated code time" box.

So one generate would make the LED's light up for that certain amount of time, and to make a pattern just repeat this process. There are some black boxes beside the checkboxes, these are for marking the full line of LED's to save time not having to click every single checkbox.

When you are satisfied with your code you can click Ctrl+C (you don't have to mark anything) and it will copy your code to the clipboard. Then you click the "Main Code" button (Hotkey = Ctrl+Enter), and your Arduino code will pop up. Insert your generated code into this code where it says "Replace this with generated code" and click "Copy to Clipboard".

Now all you have to do is open your Arduino program and insert the code you have in your clipboard (Ctrl+v).

Arduino can also be opened from the Code Generator program where it says "Open Arduino" if you have it installed at "C:\Program Files (x86)\Arduino\arduino.exe"

If you click the "info" button there will be short info about the program and the hotkeys are listed there.

Hotkeys:

Ctrl+I = Info box

Ctrl+A = Mark/Unmark all boxes

Ctrl+X = Uncheck all boxes

Ctrl+Z = Undo generated code

Ctrl+C = Copy generated code

Enter = Generate code

Ctrl+Enter = Open main Arduino code

Delete = Remove all generated code from textbox

19.03.2015 - Changed the label names from "columns" to "planes" to make the explanation of the cube more clear. Nothing else was done so the previous version is just as good, but with different labels of the planes.

10.02.2016 - Added several pre made patterns as "Patterns.zip". Here you will find some fun patterns and one extensive one that you can just open and run right away on your LED cube.

## Step 2: Building the LED Cube

This is not a instructable on how to build your LED cube, but I will explain how I did it and how this way is really simple. There are 3 pictures above that shows the soldering of the cube and how to wire everything up to the Arduino. Hopefully the Arduino drawing will be helpful.

Components used

1x Arduino Uno board

64x blue LED

1x Prototype board to mount everything on

4x 2n2222a transistors

16x ~ 95ohm resistors

4x ~1000 ohm resistors

Wires for easy plug and unplug.

Arduino Uno

I used the Arduino Uno board for my build, it has 20 digital I/O pins in total because the analog ones can also be used as digital pins. This is exactly enough to wire up the cube directly from the Arduino, which was the reason I did it. Because this is only my prototype before making the 8x8x8 cube, I wanted to make it as simple as possible.

The Arduino's digital pins can output 5V and 40mA.

The 4x4x4 cube is a total of 64 LEDs. The way it's wired it needs 16 digital outs for the Anodes and 4 digital outs for the Cathodes. The wiring will be explained in a picture above and in the text below.

The Wiring

The LEDs are wired like the picture above which gives us 16 Anodes and 4 Cathodes. Each of the anode and cathode is also marked with a number in the picture. The 16 Anodes will be connected to the digital pins:

"0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, A4, A5" in the order they are marked on the picture from 1 - 16. That means anode number 1 in the picture is digital out nr 0 on the arduino etc.

The same goes for the Cathodes where "floor" 1 is A0, "floor" 2 is A1 etc.

"A0, A1, A2, A3".

I used blue LEDs that run on 3.1V and 20mA. Since the Arduino gives out 5V this would destroy my LEDs so you need a resistor between the digital out and the LEDs to convert the 5V to 3.1V and 20mA. This is done by using the formula: (Vs - Vd) / I

Vs = Source voltage = 5V, Vd = Diode Voltage = 3.1V, I = Max current the LEDs can handle = 20mA = 0,02A

Which gives us (5 - 3.1) / 0,02 = 95 ohm.

So we would need to add 16pcs of 95ohm resistors between the digital out and the anodes to keep the LEDs from burning and to make it light up at it's full potential.

For the 4 cathode wires we would need to ground them, but we also need to control when to ground them, so we use transistors. Using transistors enables us to use a +5V digital out from the Arduino to control a transistor that is used as a switch to ground the cathode layers. I used 4 pcs of 2n2222a transistors because they can handle the current and they are fast enough.

There can be maximum 1 layer on at a time which gives us 16 * 20mA = 320mA. This is the amount of current the transistor needs to be able to handle. It is also important to use NPN and not PNP transistors.

The wire from the first floor cathode goes to the collector of the transistor.

The emitter is connected to ground on the Arduino.

And the base of the transistor is connected to a 1kohm resistor and then to the pin A0.

Repeat this for the remaining 3 floors of cathodes.

So to summarize the wiring:

16 digital out's to - 95ohm resistors, from there to the 16 anodes.

4 digital out's to - 1kohm resistors, from there to the base of the transistors.

From the cube's 4 floor cathodes to the transistor "collector".

From the transistor "emitter" to ground on the Arduino.

And that's all there is to it, if you have any questions feel free to comment.

## 8 People Made This Project!

• See 4 more that made it

## Recommendations

• ### Arduino Class

68,835 Enrolled

• ### Woodworking Contest

We have a be nice policy.

## Questions

0

I need some serious help I uploaded the code and it works great except for one thing the led on and off are inverted is there someway in the code to invert that instead of programming the 1 and 0 opposite because i want to upload this in to it but I don't want to go and change everything by hand.

any way this is what I don't want to change by hand I don't have the patience for it.

// circle full layer at bottom

B0000,B0000,B0100,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B0000,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B0010,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B1110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B1110,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B1110,B1100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B1110,B1110, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B1110,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1110,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0001,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0011,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 20,

// circle full layer at bottom

B0000,B0000,B0100,B0000, B0000,B0000,B0100,B0000, B0000,B0000,B0100,B0000, B0000,B0000,B0100,B0000, 10,

B0000,B0000,B0110,B0000, B0000,B0000,B0110,B0000, B0000,B0000,B0110,B0000, B0000,B0000,B0110,B0000, 10,

B0000,B0010,B0110,B0000, B0000,B0010,B0110,B0000, B0000,B0010,B0110,B0000, B0000,B0010,B0110,B0000, 10,

B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, 10,

B0000,B1110,B0110,B0000, B0000,B1110,B0110,B0000, B0000,B1110,B0110,B0000, B0000,B1110,B0110,B0000, 10,

B0000,B1110,B1110,B0000, B0000,B1110,B1110,B0000, B0000,B1110,B1110,B0000, B0000,B1110,B1110,B0000, 10,

B0000,B1110,B1110,B1000, B0000,B1110,B1110,B1000, B0000,B1110,B1110,B1000, B0000,B1110,B1110,B1000, 10,

B0000,B1110,B1110,B1100, B0000,B1110,B1110,B1100, B0000,B1110,B1110,B1100, B0000,B1110,B1110,B1100, 10,

B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, 10,

B0000,B1110,B1110,B1111, B0000,B1110,B1110,B1111, B0000,B1110,B1110,B1111, B0000,B1110,B1110,B1111, 10,

B0000,B1110,B1111,B1111, B0000,B1110,B1111,B1111, B0000,B1110,B1111,B1111, B0000,B1110,B1111,B1111, 10,

B0000,B1111,B1111,B1111, B0000,B1111,B1111,B1111, B0000,B1111,B1111,B1111, B0000,B1111,B1111,B1111, 10,

B0001,B1111,B1111,B1111, B0001,B1111,B1111,B1111, B0001,B1111,B1111,B1111, B0001,B1111,B1111,B1111, 10,

B0011,B1111,B1111,B1111, B0011,B1111,B1111,B1111, B0011,B1111,B1111,B1111, B0011,B1111,B1111,B1111, 10,

B0111,B1111,B1111,B1111, B0111,B1111,B1111,B1111, B0111,B1111,B1111,B1111, B0111,B1111,B1111,B1111, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

// loop all borders around

B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

B0000,B1111,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

B0000,B0000,B1111,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B1111,B0000, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1111,B0000,B0000, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, 5,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 5,

// and again

B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B0000,B1111,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B0000,B0000,B1111,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B1111,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1111,B0000,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 2,

// all borders

B1111,B1001,B1001,B1111, B1001,B0000,B0000,B1001, B1001,B0000,B0000,B1001, B1111,B1001,B1001,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1001,B1001,B1111, B1001,B0000,B0000,B1001, B1001,B0000,B0000,B1001, B1111,B1001,B1001,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1001,B1001,B1111, B1001,B0000,B0000,B1001, B1001,B0000,B0000,B1001, B1111,B1001,B1001,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

// all borders fall down from back top to front bottom

B1111,B1001,B1001,B1111, B1001,B0000,B0000,B1001, B1001,B0000,B0000,B1001, B1111,B1001,B1001,B1111, 100,

B1111,B1001,B1001,B1111, B1001,B0000,B0000,B1001, B1111,B0000,B0000,B1001, B0000,B1111,B1001,B1111, 8,

B1111,B1001,B1001,B1111, B1111,B0000,B0000,B1001, B0000,B1111,B0000,B1001, B0000,B0000,B1111,B1111, 8,

B1111,B1001,B1001,B1111, B0000,B1111,B0000,B1001, B0000,B0000,B1111,B1001, B0000,B0000,B0000,B1111, 8,

B0000,B1111,B1001,B1111, B0000,B0000,B1111,B1001, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, 8,

B0000,B0000,B1111,B1111, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 8,

B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 8,

// 4 at the time to make a block

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10, // left bottom front

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 10, // right top, back

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 10, // right top, front

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10, // left bottom, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10, // right bottom front

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 10, // left top, back

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 10, // left top, front

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10, // right bottom, back

// rotate corner 4 leds

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 20, // left bottom front and right top, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 20, // right bottom front and left top, back

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 20, // left top, front and right bottom, back

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 20, // left bottom, back and right top, front

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 15, // left bottom front and right top, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 15, // right bottom front and left top, back

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 15, // left top, front and right bottom, back

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 15, // left bottom, back and right top, front

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 10, // left bottom front and right top, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 10, // right bottom front and left top, back

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 10, // left top, front and right bottom, back

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 10, // left bottom, back and right top, front

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 7, // left bottom front and right top, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 7, // right bottom front and left top, back

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 7, // left top, front and right bottom, back

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 7, // left bottom, back and right top, front

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 5, // left bottom front and right top, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 5, // right bottom front and left top, back

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 5, // left top, front and right bottom, back

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 5, // left bottom, back and right top, front

B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, 2, // left bottom front and right top, back

B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, 2, // right bottom front and left top, back

B1100,B1100,B0000,B0000, B1100,B1100,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, 2, // left top, front and right bottom, back

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B1100,B1100, B0000,B0000,B1100,B1100, 2, // left bottom, back and right top, front

// bottom layer, to top though middle

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 30,

B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, 2,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, 20,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

// loop top and bottom corners

B0100,B0000,B0000,B0010, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0100,B0000,B0000,B0010, 5,

B0010,B0000,B0000,B0100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0010,B0000,B0000,B0100, 5,

B0001,B0000,B0000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B0000,B0000,B1000, 5,

B0000,B0001,B1000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0001,B1000,B0000, 5,

B0000,B1000,B0001,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1000,B0001,B0000, 5,

B1000,B0000,B0000,B0001, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1000,B0000,B0000,B0001, 5,

// again

B0100,B0000,B0000,B0010, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0100,B0000,B0000,B0010, 5,

B0010,B0000,B0000,B0100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0010,B0000,B0000,B0100, 5,

B0001,B0000,B0000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B0000,B0000,B1000, 5,

B0000,B0001,B1000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0001,B1000,B0000, 5,

B0000,B1000,B0001,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1000,B0001,B0000, 5,

B1000,B0000,B0000,B0001, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1000,B0000,B0000,B0001, 5,

// loop up and down full layer

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0001,B0000,B0000,B0000, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0001,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 10,

B0001,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, 10,

B0001,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 10,

B0001,B0000,B0000,B0000, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

// loop left and right full layer

B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, 10,

B0010,B0010,B0010,B0010, B0010,B0010,B0010,B0010, B0010,B0010,B0010,B0010, B0010,B0010,B0010,B0010, 10,

B0100,B0100,B0100,B0100, B0100,B0100,B0100,B0100, B0100,B0100,B0100,B0100, B0100,B0100,B0100,B0100, 10,

B1000,B1000,B1000,B1000, B1000,B1000,B1000,B1000, B1000,B1000,B1000,B1000, B1000,B1000,B1000,B1000, 10,

B0100,B0100,B0100,B0100, B0100,B0100,B0100,B0100, B0100,B0100,B0100,B0100, B0100,B0100,B0100,B0100, 10,

B0010,B0010,B0010,B0010, B0010,B0010,B0010,B0010, B0010,B0010,B0010,B0010, B0010,B0010,B0010,B0010, 10,

B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, 10,

B1001,B1001,B1001,B1001, B1001,B1001,B1001,B1001, B1001,B1001,B1001,B1001, B1001,B1001,B1001,B1001, 10,

B1111,B1111,B1111,B1111, B1001,B1001,B1001,B1001, B1001,B1001,B1001,B1001, B1001,B1001,B1001,B1001, 10,

B1111,B1111,B1111,B1111, B1001,B1001,B1001,B1001, B1001,B1001,B1001,B1001, B1111,B1111,B1111,B1111, 10,

B1111,B1111,B1111,B1111, B1111,B1001,B1001,B1111, B1111,B1001,B1001,B1111, B1111,B1111,B1111,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 10,

// outer cube, inner cube

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 10,

// circle layer by layer bottom to top

B0000,B0000,B0100,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0010,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B1110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B1110,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B1110,B1100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B1110,B1110, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B1110,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1110,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0001,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0011,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0100,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0010,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B0110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B1110,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1110, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1110,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0001,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0011,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0100,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0110,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0010,B0110,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B0110,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B0000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1000, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1100, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1110, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1111,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0011,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0100,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0110,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0010,B0110,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B0110,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B0000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1000, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1100, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1110, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1111, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1110,B1111,B1111, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1111,B1111,B1111, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B1111,B1111,B1111, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0011,B1111,B1111,B1111, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0111,B1111,B1111,B1111, 6,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B1111,B1111,B1111, 6,

B0001,B0000,B0000,B0000, B0001,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0011,B0000,B0000,B0000, B0011,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0011,B0010,B0000,B0000, B0011,B0010,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0011,B0011,B0000,B0000, B0011,B0011,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0110,B0110,B0000,B0000, B0110,B0110,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0110,B0110,B0000,B0000, B0110,B0110,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0110,B0110,B0000, B0000,B0110,B0110,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0110,B0110, B0000,B0000,B0110,B0110, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0011,B0011, B0000,B0000,B0011,B0011, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0001,B0011,B0111, B0000,B0001,B0011,B0111, B0000,B0000,B0001,B0011, 10,

B0000,B0000,B0000,B0000, B0000,B0011,B0111,B0111, B0000,B0011,B0111,B0111, B0000,B0001,B0011,B0111, 10,

B0000,B0000,B0000,B0000, B0000,B0111,B0111,B0111, B0000,B0111,B0111,B0111, B0000,B0011,B0111,B0111, 10,

B0000,B0000,B0000,B0000, B0000,B0111,B0111,B0111, B0000,B0111,B0111,B0111, B0000,B0111,B0111,B0111, 10,

B0000,B0000,B0000,B0000, B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, 10,

B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, B0000,B0000,B0000,B0000, 10,

B0000,B1110,B1110,B1110, B0000,B1110,B1110,B1110, B0000,B1100,B1110,B1110, B0000,B0000,B0000,B0000, 10,

B0000,B1110,B1110,B1110, B0000,B1100,B1110,B1110, B0000,B1000,B1100,B1110, B0000,B0000,B0000,B0000, 10,

B0000,B1100,B1110,B1110, B0000,B1000,B1100,B1110, B0000,B0000,B1000,B1100, B0000,B0000,B0000,B0000, 10,

B0000,B1000,B1100,B1110, B0000,B0000,B1000,B1100, B0000,B0000,B0000,B1000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B1000,B1100, B0000,B0000,B0000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B1000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B1000,B1000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1000,B1000,B1000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1100,B1000,B1000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1110,B1000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1110,B0000,B0000,B0000, B0010,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0110,B0000,B0000,B0000, B0011,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0010,B0000,B0000,B0000, B0011,B0001,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0011,B0001,B0001,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0001,B0001,B0001,B0001, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0001,B0001,B0011, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0001,B0111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1110, B0000,B0000,B0000,B1000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1100, B0000,B0000,B1000,B1000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1000, B0000,B0000,B1100,B1000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B1110,B1000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B1111,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0001,B0111,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B0001,B0011,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B0001,B0001,B0000, B0001,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B0001,B0000,B0000, B0011,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0001,B0000,B0000,B0000, B0111,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1111,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1110,B1000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1100,B1100,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B1000,B1110,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B1111,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0111,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0011,B0000,B0000, 10,

B0000,B0001,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0001,B0000,B0000, 10,

B0001,B0001,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0011,B0001,B0000,B0000, B0000,B0001,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0111,B0001,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1100,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1110,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B0001,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B0011,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B0111,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1100, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1110, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0111,B0111,B0111,B0111, B1000,B1000,B1000,B1000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0011,B0011,B0011,B0011, B0100,B0100,B0100,B0100, B1000,B1000,B1000,B1000, B0000,B0000,B0000,B0000, 10,

B0001,B0001,B0001,B0001, B0010,B0010,B0010,B0010, B0100,B0100,B0100,B0100, B1000,B1000,B1000,B1000, 10,

B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0010,B0010,B0010,B0010, B0100,B0100,B0100,B0100, 10,

B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0010,B0010,B0010,B0010, 10,

B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, B0001,B0001,B0001,B0001, 10,

B0010,B0001,B0001,B0001, B0010,B0001,B0001,B0001, B0010,B0001,B0001,B0001, B0010,B0001,B0001,B0001, 10,

B0100,B0010,B0001,B0001, B0100,B0010,B0001,B0001, B0100,B0010,B0001,B0001, B0100,B0010,B0001,B0001, 10,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 10,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 10,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 10,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 10,

B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, 10,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 10,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 10,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 10,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 10,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 10,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 10,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 10,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 10,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 10,

B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, 10,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 10,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 10,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 8,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 8,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 8,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 8,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 8,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 8,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 8,

B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, 8,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 8,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 8,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 8,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 8,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 8,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 8,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 7,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 7,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 7,

B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, 7,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 7,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 7,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 7,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 7,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 7,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 7,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 6,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 6,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 6,

B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, 6,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 6,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 6,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 6,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 6,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 6,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 6,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 6,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 6,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 6,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 6,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 5,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 5,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 5,

B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, B0010,B0010,B0100,B0100, 5,

B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, B0100,B0100,B0010,B0010, 5,

B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, B1000,B0100,B0010,B0001, 5,

B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, B0000,B1100,B0011,B0000, 5,

B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, B0000,B0011,B1100,B0000, 10,

B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 10,

B0000,B0010,B0100,B0000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 10,

B0000,B0000,B0000,B0000, B0000,B0010,B0100,B0000, B0001,B0010,B0100,B1000, B0001,B0010,B0100,B1000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0010,B0100,B0000, B0001,B0010,B0100,B1000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0010,B0100,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1000, B0000,B0010,B0000,B1000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B1000, B0000,B0010,B0000,B1000, B0000,B0010,B1000,B0000, 10,

B0000,B0000,B0000,B1000, B0000,B0010,B0000,B1000, B0000,B0010,B1000,B0000, B0000,B0000,B1000,B0000, 10,

B0000,B0010,B0000,B1000, B0000,B0010,B1000,B0000, B0000,B0000,B1000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0010,B1000,B0000, B0000,B0000,B1000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B1000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0100,B0010,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0110,B0110,B0000, B0000,B0100,B0010,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1001,B0110,B0110,B1001, B0000,B0110,B0110,B0000, B0000,B0100,B0010,B0000, B0000,B0000,B0000,B0000, 10,

B1101,B0111,B1110,B1011, B1001,B0110,B0110,B1001, B0000,B0110,B0110,B0000, B0000,B0100,B0010,B0000, 10,

B1111,B1111,B1111,B1111, B1101,B0111,B1110,B1011, B1001,B0110,B0110,B1001, B0000,B0110,B0110,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1101,B0111,B1110,B1011, B1001,B0110,B0110,B1001, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1101,B0111,B1110,B1011, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B1111,B1111,B1111,B1111, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, B0000,B0000,B0000,B0000, 10,

Thanks! MariusG1 for the instructions and code. Here is a video of the cube working.

hello

can u share the code for atmega328p?

hey budddy so i built a really big 4x4x4 and i built it backwards or opposite and im having a hard time i guess finding the correct pinout the cube lights up but doesnt do what it should. i copied codes and tryed them out and im not getting the right animations i assume its not hooked up to right pins can u offer help to get the cube proper
tha ks a mill

4 replies

I just learned a little more about sinking current with the arduino and I think we can solve it with a little change in the code. I'm not sure but you can try it out.

So what you do is you wire the 4 planes that you now have as anodes to A0, A1, A2, A3. And then you connect your 16 cathodes to the rest of the pins. So basicly just the same way as the picture I have of the arduino with connections but you remove the transistors and your cube is opposite.

What we see now is that you only have 4 pins to supply current (A0-A3) and you have to define the 16 pins to sink current, this means they function like ground because their potential is defined as 0V so you get current flow. Only having 4 pins to supply voltage could be a potential problem if they cannot supply enough, but since the LEDs are on for only a cycle (they blink really fast) the current needed is less and I think it might work.

Use 16pcs of 100ohm resistors between the arduino pins and the cathodes. If you didn't understand this, just let me know and I'll make a schematic. I will inbox you the code changes so you can try it out.

Hi there, I was hoping to find a way to program the lights, GREAT WORK! I have a question, however, when you explain LCCG - OPPOSITE.exe you make it sound like no big deal if the cube was wired that way - "If you wired your cube "opposite" and made the anodes the floors and the cathodes the columns then you can simply download the "LCCG OPPOSITE" instead." Mine is!I simply follow the schematic still? on 10-31-2015, you talk about removing the transistors and having new code...

"So what you do is you wire the 4 planes that you now have as anodes to A0, A1, A2, A3. And then you connect your 16 cathodes to the rest of the pins. So basicly just the same way as the picture I have of the arduino with connections but you remove the transistors and your cube is opposite."

I'm not sure what to do, I was going to etch a board for this so any help you can provided would be appreciated.

Would you be willing to give me the schematic for this as I have my planes as anodes and have the 16 cathodes to the rest of the pins?

was thus directed at me. ? the cube works with kylethecreators code n pinout. how can i use ur method to use b1000 with same pinout or what pinout do i use my cube is wired backwards

where is the wiring for led cube
will the code generated be for arduino uno

Am a novice and is confused.

On
https://www.instructables.com/id/4x4x4-LED-Cube-Arduino-Uno/step2/Making-The-LED-Jig/I
see the anodes horizontally and cathodes connected vertically.

On
https://www.instructables.com/id/LED-CUBE-CODE-4x4x4-Arduino/I see the vertical
anodes and cathodes horizontally.

I am wrong and how is
it anyway?

LCCG and LCCG OPPOSITE zip files contain what seems to be the same generator. I have my cube wired in the opposite manner and when I try to generate a pattern using the generator, my cube lights up erratically. I would like to show only one LED on at a time.

3 replies

Also, I did not use transistors on my plane pins. Could this be the problem?

Sorry for the late reply, you probably fixed this already. If you didn't and someone else is wondering: Yes you ABSOLUTELY need transistors, they are there to sink current from the other 16 pins.

Thanks. I will set up the cube again and see if transistors fix the problem. I need to replace one LED that has stopped working.

I have seen in science fair, one older guy, who built 16X16x16..where he connected a video camera and turn it into a human head in 3D (low resolution of course)...he wouldn t share the code, but it was really cool

Wow, that sounds like one hell of a job!!

great project indeed..thumbs up

I buy "4X4X4 Light Cube Kit Blue Arduino shield" on Ebay. This kid have litle bit different wiring, use two 74HC595 shift register chips to drive anodes. Below is modifed main part of program to work with this kit and generated code.

....................

// this is a dummy element for end of table (duration=0) aka !!!DO NOT TOUCH!!!
B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 0
};

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps
*/

int PlanePin[] = {4, 5, 6, 7};

int clockPin=0; //SH_CP of 74HC595
int latchPin=1; //ST_CP of 74HC595
int dataPin=3; //DS of 74HC595
int HC_595_E = 2;

// initialization
void setup()
{

int pin; // loop counter

pinMode( latchPin, OUTPUT );
pinMode( clockPin, OUTPUT );
pinMode( dataPin, OUTPUT );
pinMode( HC_595_E, OUTPUT );

// set up plane pins as outputs (active LOW)
for (pin=0; pin<CUBESIZE; pin++) {
pinMode( PlanePin[pin], OUTPUT );
digitalWrite(PlanePin[pin],LOW);
}

}

// display pattern in table until DisplayTime is zero (then repeat)
void loop()
{
// declare variables
byte PatternBuf[PLANESIZE]; // saves current pattern from PatternTable
int PatternIdx;
byte DisplayTime; // time*100ms to display pattern
unsigned long EndTime;
int plane; // loop counter for cube refresh
int patbufidx; // indexes which byte from pattern buffer
int ledrow; // counts LEDs in refresh loop
int ledcol; // counts LEDs in refresh loop
int ledpin; // counts LEDs in refresh loop

// Initialize PatternIdx to beginning of pattern table
PatternIdx = 0;
// loop over entries in pattern table - while DisplayTime>0
do {
// read pattern from PROGMEM and save in array
memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );
PatternIdx += PLANESIZE;
// read DisplayTime from PROGMEM and increment index
DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ );
// compute EndTime from current time (ms) and DisplayTime
EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;

// loop while DisplayTime>0 and current time < EndTime
while ( millis() < EndTime ) {
patbufidx = 0; // reset index counter to beginning of buffer
// loop over planes
for (plane=0; plane<CUBESIZE; plane++) {
// turn previous plane off
if (plane==0) {
digitalWrite( PlanePin[CUBESIZE-1], HIGH );
} else {
digitalWrite( PlanePin[plane-1], HIGH );
}

digitalWrite(latchPin, LOW);
digitalWrite(HC_595_E, HIGH);
shiftOut(dataPin, clockPin, LSBFIRST, (PatternBuf[patbufidx++]|(PatternBuf[patbufidx++] << 4)));
shiftOut(dataPin, clockPin, LSBFIRST, (PatternBuf[patbufidx++]|(PatternBuf[patbufidx++] << 4)));
digitalWrite(latchPin, HIGH);
digitalWrite(HC_595_E, LOW);

// turn current plane on
digitalWrite( PlanePin[plane], LOW );
// delay PLANETIME us
delayMicroseconds( PLANETIME );

} // for plane
} // while <EndTime
} while (DisplayTime > 0); // read patterns until time=0 which signals end
}

3 replies

You are a life saver, thank you for the updated code.

Hi ,I too got the same cube kit as you and got the same problems as you could you plz send me the code you were sent ,it's driving me crazy.my email is" shaunny@outlook.com " would really help me out thanks

To: jbmelectric.............I too bought the same 4x4x4 LED cube on eBay that you bought. I am not near as advanced in my Arduino/electronics hobby as you are so I haven't been able to get mine to work properly and I don't understand your explanation on how to work around the 74HC595. I wonder if you could take some time to help me, maybe on fb or skype. Please contact me at usthom2000@yahoo.com and we can go from there. I would be forever grateful for your help. Thank you, Thom Mulford