Strange problem - need unused variable to make (Blink like) sketch run

lar3ry:

int led = 7;         //  This assigns the value 7 to a variable called led

void setup() {                
  led++;                //  This increments led, making it have a value of 8
 for ( int i=7;i<14;i++){      // these two lines set pins 7 - 13 to OUTPUT
   pinMode(i, OUTPUT);
 }
}

void loop() {
 for ( int i=7;i<14;i++){
   digitalWrite(i, HIGH);  // This line sets pins 7 - 13 HIGH, 1 pin per loop
   delay(100);
   digitalWrite(i, LOW);  // This line sets pins 7 - 13 LOW, 1 pin per loop
   delay(100);
 }
} // and this line makes it go all around the loop, setting pins 7 - 13 HIGH/LOW in turn




You need to use the variable **led** in your digitalWrite(). Just because you called it led, doesn't make it automatically know what to do.

I am using variable i in digitalWrite, which goes from 7 to 13 to make blik different diodes. Just namind the variable led does not mean I want it use for anything. This code works and makes running light over leds 7-13, regardles value of led variable.

The problem is, when I comment out the led variable (both declaration and incrementation) the sketch stops working and lights only led 7. And I do not understand why, because the variable led here is totally nonsencial (it is rest from Blik sketch and when i deleted it it istopped working. When I returned it, it worked again.)