servo case structure issue

@wildbill

Thanks for your reply. I was under the presumption that the if statement would constantly be run until 5 seconds had passed, and the if statement condition would be met, resulting in a switch to case two.

Ive removed the if statement and the timer variable and replaced it with a 5 second delay:

switch (state)
  {
    case one:
    myservo1.writeMicroseconds(1374);
    delay(5000);
    myservo1.writeMicroseconds(1474);
    delay(5000);
    state = two;
    break;

    case two:
    for(int speedv1 = 0; speedv1 <= 100; speedv1 += 2) // loop to ramp up speed of servos
    {
      myservo1.writeMicroseconds(1474 + speedv1); // speed increase by 2 each iteration (servo 1) until servo reaches fullspeed (ACW)
      delay(40); // delay between loop iterations
    }
    delay(5000);
    for(int speedv2 = 0; speedv2 <= 100; speedv2 += 2) // loop to ramp down servo speed
    {
      myservo1.writeMicroseconds(1574 - speedv2); // speed decrease by 2 each iteration (servo 1) until servo stops
      delay(40); //delay between loop iterations 
    }
    delay(2000);
    state = one;
    break;
  }
}]

For some reason, the first state is run successfully, but then it just repeats itself and there is no transition to state two. Why would this occur as I clearly set the variable state as two...