Counting a loop

bullroarer:
The delays count the times the loop has ran. A little guidance on fixes and/or changes would be nice. Regarding my comment of switching positions, there are five different sections, potentially confusing to inexperienced users.

It will be hard to tell if your code is doing what you want, when your if() statements are not syntactically correct.

if ( 50 < pos < 130 )  {
}

This should be re-written as:

if (50 < pos && pos < 130) {
}

Please also consider that you may want to use <= instead, depending on whether you mean to include the values 50 and 130 in your range or not.