I have been coding animations for my arduino powered LED cube recently and I seem to have come across a bit of code that killed my diecimila.
long Random;
////////////////0 1 2 3 4 5 6 7 8 9 10 11
//int pins[] = {2,3,4,5,6,7,8,9,10,11,12,13};
int pins[] = {2,6,10,3,7,13,4,8,12,5,9,11};
int time = 10;
int time2 = 250;
int time3 = 0;
int time4 = 100;
void setup()
{
pinMode(pins[0], OUTPUT); //2 g
pinMode(pins[1], OUTPUT); //3 3
pinMode(pins[2], OUTPUT); //4 6
pinMode(pins[3], OUTPUT); //5 9
pinMode(pins[4], OUTPUT); //6 g
pinMode(pins[5], OUTPUT); //7 2
pinMode(pins[6], OUTPUT); //8 5
pinMode(pins[7], OUTPUT); //9 8
pinMode(pins[8], OUTPUT); //10 g
pinMode(pins[9], OUTPUT); //11 1
pinMode(pins[10], OUTPUT); //12 4
pinMode(pins[11], OUTPUT); //13 7
//Serial.begin(9600);
}
void loop()
{
//START Moving Walls
digitalWrite(pins[0], LOW);
digitalWrite(pins[1], HIGH);
digitalWrite(pins[2], HIGH);
int c = 3;
while(c<=9)
{
for(int l = 0; l<=2; l++) //Controls which layer is lit
{
for(int i =c; i < i+3; i++)
{
digitalWrite(pins[i], HIGH);
digitalWrite(pins[i], LOW);
}
digitalWrite(pins[l], HIGH); //Increments layer in voltage
if(l != 2)
{
digitalWrite(pins[l+1], LOW);
}
else
{
digitalWrite(pins[0], LOW);
}
}
c = c+3;
delay(time2);
if(c > 9)
{
c=3;
}
}
//END Moving Walls
}
After running that bit of code my arduino has stopped accepting new uploads. It runs(with a quick flash of my LEDs) when I first power up the arduino, but I cannot do anything else. I just get the error stk500_recv(): programmer is not responding
So, was it my code that did it or did I just get a borked piece of hardware? I use very similar code in other animations(in fact I mostly just changed a timing variable I think). I'm on 10.5.4 with the latest arduino software.