using a button to Sweep a servo to several locations at different speeds

I'm learning to use Arduino and need to use a button to sweep a servo to 4 locations at different speeds.

I think this can be done using clicks since and if statement will only give me an else meaning two positions but i'm not sure how to apply the clicks to the code.

looking at the sweep example i understand the pos is the position so i need to change that per click "for (pos = 180; pos >= 0; pos += 1) ", right?

I would appreciate some guidance.

Thank you!

What the @$&+ is a "click"? I think that you are looking at some code or some documentation that we cannot see.

Timing will be important if the servos are to sweep at different rates. You may want to look at the below to see info on timing setups.

https://forum.arduino.cc/index.php?topic=223286.0

Do you really mean one servo doing 4 different things at different times?

If by "clicks" you mean multiple button presses then the problem is that you have to wait for some defined amount of time after the first press to see if there is going to be a second press and then wait to see if there is a third press etc. It makes the response quite slow. Is that what you're aiming for?

When you get that sorted out the rest is simple. In Sweep, as you say the position is governed by pos. The speed of movement is controlled by the value in the delay(15) statement. Larger number, slower move etc.

Steve