Killer code?
i have been coding animations arduino powered led cube , seem have come across bit of code killed diecimila.
after running bit of code arduino has stopped accepting new uploads. runs(with quick flash of leds) when first power arduino, cannot else. i error stk500_recv(): programmer not responding
so, code did or did borked piece of hardware? use similar code in other animations(in fact changed timing variable think). i'm on 10.5.4 latest arduino software.
code: [select]
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 layer lit
{
for(int =c; < 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 bit of code arduino has stopped accepting new uploads. runs(with quick flash of leds) when first power arduino, cannot else. i error stk500_recv(): programmer not responding
so, code did or did borked piece of hardware? use similar code in other animations(in fact changed timing variable think). i'm on 10.5.4 latest arduino software.
you can't like
because less + 3. instead like
this shouldn't kill board though, try loading blink example sketch, verifying it, pressing reset button on arduino right after press upload button (or @ same time?).
code: [select]
for(int =c; < i+3; i++) because less + 3. instead like
code: [select]
for(int =c; < c + 3; i++)
{
digitalwrite(pins[i], high);
digitalwrite(pins[i], low);
}
this shouldn't kill board though, try loading blink example sketch, verifying it, pressing reset button on arduino right after press upload button (or @ same time?).
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Killer code?
arduino
Comments
Post a Comment