# 3x3x3 Led Cube and Arrays

Okay, so recently I made a 3x3x3 led cube. As you can see in my cube, it has a pretty simple structure. If one column and one layer are both turned on, then the corresponding LED on the cube lights up. I figured out that you can use array to store all of the variables more easily. However, I can’t get the layers to turn on using their array. Here is my code, maybe a second set of eyes will yield that answer to my problem.

Layer 11,12,13 correspond to 1, 2 and 3

int const time = 100;
int Column={0,1,2,3,4,5,6,7,8};
int Layer={11,12,13};
int columnCount = 9;
int layerCount = 3;

void setup(){
for(int i = 0; i<columnCount;i++){
pinMode(Column*, OUTPUT);*

• }*
• for(int i = 10 ; i<layerCount;i++){*
_ pinMode(Layer*,OUTPUT);*_

* }*
}
void loop(){
digitalWrite(Column,HIGH);
digitalWrite(Layer,HIGH);
}
[/color]
LED.ino (438 Bytes)

This part is too simple

``````void loop(){
digitalWrite(Column,HIGH);
digitalWrite(Layer,HIGH);
}
``````

You need a loop within a loop to cycle thru all the columns and all the layers with some hold time, like 1mS, to allow an LED to be seen before switching to the next one.
What you don't have is an array holding the data that will be displayed.

Layer 11,12,13 correspond to 1, 2 and 3

What does this mean? The values in Layer (11, 12, and 13) are pin numbers. What are 1, 2, and 3? If they are layer numbers, then they are layers 0, 1, and 2.

And, I don't believe your code actually looks like that.

PaulS:

Layer 11,12,13 correspond to 1, 2 and 3

What does this mean? The values in Layer (11, 12, and 13) are pin numbers. What are 1, 2, and 3? If they are layer numbers, then they are layers 0, 1, and 2.

And, I don't believe your code actually looks like that.

Sorry for the misunderstanding, I didn't write it very well. It is working now that I know that the layers are 0, 1, and 2. Thank you for your reply