arduino examples/Loop iteraion

Couple of observations.

int thisPin = 2;
...
for (thisPin < 8; thisPin++) {

You initialise thisPin on the first line. Then in the for loop, you have left out the the usual initialise part in the brackets; you have just the test and increment parts: "thisPin < 8" and "thisPin++".

According to for - Arduino Reference, I believe this may be OK, but you may need to include an extra semicolon, like this:

for (; thisPin < 8; thisPin++) {

In the second for loop, you have:

for thisPin < = 7; thisPin--) {

Probably needs an opening bracket and maybe that semicolon. But I'm also wondering about when the loop will stop looping. thisPin starts at 8 after the previous loop? You then subtract one each time round this loop. And you keep going so long as "thisPin <= 7".

If thisPin starts out at 8, and the test is done before subtracting one from thisPin, the second loop will never run, because thisPin is already not <= 7.

If it starts at less than 8, the loop will carry on a long time. thisPin is declared as int, which can go negative, down to -32,768 I think. That will confuse the digitalWrite.

What values were you expecting thisPin to take? And was there a particular reason for not including all three parts in each for loop brackets, the initialise, test and increment / decrement?

All the best

Ray