While loop to infinite

Hi guys,

just realized that i forgot the operators -really good point awol!! Changed the code so many times, that i didn´t look at this part anymore.
After putting in a && and a ||-operator-one at a time- i still got the same problem...

@PaulS:

i don´t get your point....
i was refering to a construct as follow:

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}

but with several servos at a time.

using the for loop to write both values would need a if statment to check if the iteration need to be positiv or negativ(-> the stop criteria needs to change, too)
this does not seem to be to hard while using 2 servos but doing the sam with 4 servos , leads to 4! diffrent if-statments.....

But anyway it´s more about my while-loop construct!
i´d like to get it working. I think it would be quite useful for people who want to do something similar.

thanks for your input

regards
J