Have you tested a simple sketch that just flashes leds, something like this:
int pinArray[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
int count = 0;
void setup(){
}
void loop() {
for (count=5;count<17;count++) {
pinMode(pinArray[count], OUTPUT);
digitalWrite(pinArray[count],HIGH);
delay(500);
digitalWrite(pinArray[count],LOW);
delay(500);
pinMode(pinArray[count], INPUT);
delay(500);
}
}
If that works as expected , it may narrow down the things that could be going wrongIt didn't work. I changed your "for" statement so it goes through all the pins: for (count=0;count<17;count++), and it works fine on all pins from 0 to 13 but it will not work for the analog pins.
Is my arduino (Arduino NG, Atmega8) not working right? I doubt it. Because when I use port registers, it works all fine.
I will really appreciate if someone could try on their own arduino this simple task.