for(int speed = -100; speed >= 0; speed += 2)
{
servoLeft.writeMicroseconds(1500+speed);
servoRight.writeMicroseconds(1500-speed);
delay(20);
}
Starting with speed at -100, while speed is greater than or equal 0, do some stuff, then increment speed by 2. How many times do you think the "do some stuff" part is going to happen? Yep, that's right. None.
for(int speed = 0; speed <= 100; speed -= 2)
{
servoLeft.writeMicroseconds(1500+speed);
servoRight.writeMicroseconds(1500-speed);
delay(20);
}
Starting with speed at 0, while speed is less than or equal 100, do some stuff, then decrement speed by 2. How many times do you think the "do some stuff" part s going to happen? 0, -2, -4, -6, -10, ..., -32768, 2, 4,... That loop will take quite a while to complete.