Hey guys,
I've built a 555 LED cube, and am trying to write code to control it.
Right now, my code goes:
int values[151] =
{
0,
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1,
//End of first layer.
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1,
//end of second layer
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1,
//end of third layer
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1,
//end of fourth layer
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1,
//end of fifth layer
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1
};
void setup()
{
for (int i=21; i <= 52; i++)
{
pinMode(i,OUTPUT);
}
}
void loop()
{
for (int z = 0; z<=5; z++)
{
for (int i = 48; i <=52; i++)
{
digitalWrite(i,HIGH);
}
digitalWrite(47+z,LOW);
for (int i=0; i <= 25; i++)
{
if (values[i+z*25]== 1)
{
digitalWrite(i+21,HIGH);
}
if (values[i+z*25]==0)
{
digitalWrite(i+21,LOW);
}
}
delay(1);
}
}
Basically, it loads a huge array of on/off values, then uses them to control the LED's.
I want to modify the code to take animations, but I keep getting errors - help?