Whats up!
So I'm currently building my first LED cube and decided to go with the Charliecube(4x4x4 RGB).
I have built a few spires already and have tried them. Although not with code.
I have a spire wired up to my UNO and am ready to upload the code. But there seems to be an error that I just cannot see... Would anyone be kind and help me?
int pins[] = {2, 3, 4, 5};
int del = 400;
void setup() {
}
void loop(){
  testLevels(400);
  delay(1000);
}
void testLevels(int _del)
{
 del = _del;
 setLED(0, 1);
 setLED(1, 2);
 setLED(2, 3);
 setLED(3, 0);
 setLED(0, 2);
 setLED(1, 3);
 setLED(2, 0);
 setLED(3, 1);
 setLED(0, 3);
 setLED(1, 0);
 setLED(2, 1);
 setLED(3, 2);
}
void testRGBbyLevel(int _del)
{
 del = _del;
 setLED(0, 1);
 setLED(0, 2);
 setLED(0, 3);
 setLED(1, 2);
 setLED(1, 3);
 setLED(1, 0);
 setLED(2, 3);
 setLED(2, 0);
 setLED(2, 1);
 setLED(3, 0);
 setLED(3, 1);
 setLED(3, 2);
}
void setLED(unsigned int cathode, unsigned int anode)
{
 if (cathode > 3 || anode > 3)
  return;
 for (int i = 0; i < 4; i++) {
  if (i == cathode) {
   pinMode(pins[i], OUTPUT);
   digitalWrite(pins[i], LOW);
  } else if (i == anode) {
   pinMode(pins[i], OUTPUT);
   digitalWrite(pins[i], HIGH);
  } else {
   pinMode(pins[i], INPUT);
  }
 }
 delay(del);
}