Newbie question; understanding fail message.

void loop() {
for (int j+1; j<=numRedBlink; j=j+1; ) [

digitalWrite(redLEDPin, HIGH);
delay(redOnTime);
digitalWrite(redLEDPin, LOW);
delay(redOffTime);
]
digitalWrite(yellowLEDPin, HIGH);
delay(yellowOnTime);
digitalWrite(yellowLEDPin, LOW);
delay(yellowOffTime);
}

Keep getting error message on “for” line. “; expected before + token”.
Any info appreciated.

Don't use square brackets to enclose code statements. They are for arrays.

This won't work either. Use "=" instead of "+".

for (int j+1; ...
for (int j+1;

That is wrong. Look up the syntax of a for statement in C.

Pete

void loop() {
for (int j=1; j<=numRedBlink; j=j+1 ) { //removed the semicolon there, changed the [ to {

 digitalWrite(redLEDPin, HIGH);
 delay(redOnTime);
 digitalWrite(redLEDPin, LOW);
 delay(redOffTime); 
}
 digitalWrite(yellowLEDPin, HIGH);
 delay(yellowOnTime);
 digitalWrite(yellowLEDPin, LOW);
 delay(yellowOffTime);
}

You have 's defining a block. That’s what curly braces do.
You had j+1 instead of j=1 (which I suspect is a typing error, not a coding error)
You had a stray semicolon at the end of the increment.

This way is a little better:

for (int j=0; j<numRedBlink; j++ )
for (int j+1; j<=numRedBlink; j=j+1 ) { //removed the semicolon there, changed the [ to {

Didn’t fix the beginning tho: int j =1;

CrossRoads:

for (int j+1; j<=numRedBlink; j=j+1 ) { //removed the semicolon there, changed the [ to {

Didn’t fix the beginning tho: int j =1;

You’re fast. I fixed it within like 20 seconds of posting it.

Not fast, just happened to see it at the right time.

Thanks everyone for responding. j+1 was the problem, changed to j=1 and all OK. Was a typing error, will be more careful in the future. Thanks again.