Servo hold tutorial, please

Hi, i am new to programming the arduino and am looking for a basic, servo button program or tutorial.
i want to move a servo from, 0 to 180 when a button is pressed and stop, then move 180 to 0 on a second button press.
all the tutorials i can find are move and return.
Thanks for any help you provide.

All you have to do is put some code in to read your button and then to carry out the appropriate servo movement code once that button is pressed. Using a counter set to 1 or 0 will determine if the servo is pointing left or right after a button press.

thanks, but as i said i am new to programming. so this doesn't really help.
thats why i am looking for a tutorial/walkthrough.

Here is a button tutorial and all you need to do is break the 'go and return' code into a 'go' and a 'return' . You might find something if you search the arduino site for 'control servo with button' (don't know though)

to get the servo to go from 180 to 0 degrees just reverse the for loop.
ie.
if(direction == 0)
{
for( int i = 0; i <= 180; i++)
{
// servo movement code

}
direction = 2; // change direction so it won't sweep again
}

else if (direction == 1)
{
for( int i = 180; i >=0; i--)// loop from from 180 to 0 degrees
{ // can increase i-- to i -= 5 to make the
// servo movement code // servo go faster

}
direction = 2;
}

thanks, still can't get any where with it.
has anyone done something similar, that can shre there code. thanks

gto, why not post any code you have and say what does and doesn't do. That is an easy way people can guide you to getting it working the way you want.

If you don't have anything yet, start with a basic servo tutorial and try to add the code clifdweller posted above