Missunderstanding in a simple 'for' loop.

Hello All,
brandnew member and tried to modify on sketch out of a starters kit.

What it should do:
8 LED should light up one after the other and then switched of by the reset function of a shiftregister.

What it’s doing:
LED 1 is blinking

For debugging I’ve added a serial monitor for i. The serial monitor is showing only 8 for every line. My expection was that it’s counting from 0 to 7 in a loop.

Here the code:

// 1 (QB) LED 2 +
// 2 (QC) LED 3 +
// 3 (QD) LED 4 +
// 4 (QE) LED 5 +
// 5 (QF) LED 6 +
// 6 (QG) LED 7 +
// 7 (QH) LED 8 +
// 8 (GND) GND
//
// 9 (QH*)
// 10 (SRCLR*) Digital 5
// 11 (SRCLK) Digital 3
// 12 (RCLK) Digital 4
// 13 (OE*) GND
// 14 (SER) Digital 2
// 15 (QA) LED 1 +
// 16 (VCC) 5V

int datapin = 2;
int clockpin = 3;
int latchpin = 4;
int resetpin = 5;
int delayT =100;
int i ;
void setup()
{
Serial.begin(9600);
pinMode(datapin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(latchpin, OUTPUT);
pinMode(resetpin, OUTPUT);
digitalWrite(resetpin, HIGH);
}

void loop()
{
for (i = 0 ; i<=7; i++);
{
digitalWrite(datapin, HIGH);
digitalWrite(clockpin, HIGH);
digitalWrite(clockpin, LOW);
delay(delayT);
digitalWrite(latchpin,HIGH);
digitalWrite(latchpin,LOW);
delay(delayT * 1);
Serial.println(i);
}

if (i==7)
{
digitalWrite(resetpin, LOW);
digitalWrite(latchpin,HIGH);
digitalWrite(latchpin,LOW);
digitalWrite(resetpin, HIGH);
}

}

thanks for every help. I’m a bit lost.
Jens

  for (i = 0 ; i<=7; i++);Oops.

Please remember to use code tags when posting code

Sorry for missing the tags.

I still didn't get your hint what's wrong with this line

Why isn't the Serial.println counting up? It's in the 'for' loop. So it should be:
0
1
2
3
4
5
6
7
0
1
2
3
.
.
.

Most likely it's really a stupid question but I'm not afraid to ask tons of these kind of questions :slight_smile:

The final semicolon on your for.
It shouldn't be there

thanks a lot for your help. I would look for decades without finding.

Now it works as it should do