int r1=1,r2=2,r3=3,r4=4,r5=5;
int c1=9,c2=10,c3=11,c4=12,c5=13;
void setup() {
// put your setup code here, to run once:
for (int i=1;i++;i<=5)
{
pinMode(i,OUTPUT);
digitalWrite(i,0);
}
for (int i=9;i++;i<=13)
{
pinMode(i,OUTPUT);
digitalWrite(i,0);
}
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(r1,1);
digitalWrite(c3,1);
delay(10);
digitalWrite(r1,0);//
digitalWrite(c3,0);//
digitalWrite(r2,1);
digitalWrite(c2,1);digitalWrite(c4,1);
delay(10);
digitalWrite(r2,0);//
digitalWrite(c2,0);digitalWrite(c4,0);//
digitalWrite(r3,1);
digitalWrite(c1,1);digitalWrite(c5,1);
delay(10);
digitalWrite(r3,0);//
digitalWrite(c1,0);digitalWrite(c5,0);//
digitalWrite(r4,1);
digitalWrite(c2,1);digitalWrite(c4,1);
delay(10);
digitalWrite(r5,1);
digitalWrite(c3,1);
delay(10);
digitalWrite(r5,0);//
digitalWrite(c3,0);//
}
this code was written to test the muxing of 5x5 led matrix.
After i upload the above program in my Arduino duemilanove, i'm always facing the same problem again and again. I can't upload any other sketch afterwards. When i try to upload them, it show the following error:-
stk500_getsync() attempt 3 of 10: not in sync: resp=0xea
i can only get out of the problem only when i keep the reset button pressed during connecting my cable to PC and releasing the button exactly before the upload process starts.
i have tried this more than 3 times. the same problem occurs every time. you can try this too. but beware : the only way to get out of the problem is to releasing reset button exactly before upload starts.
I have tried uploading other codes after getting out of the problem. But none of them caused the problem.
Can anyone explain me why this particular code is causing the above problem every time?