I'm not getting a clear idea of how you want the servo to act. Here are two possible interpretations of what you said:
- The servo begins at 0. Each time you press the joystick trigger, it moves from 0 to 180 and then back to 0, regardless of how long the trigger is held.
- While the joystick trigger is not being pressed, the servo is at 0. While the trigger is being pressed, the servo is at 180.
If #1 is what you want, keep in mind that the servo takes some time to move from 0 to 180, so you have to plan for a delay before it returns from 180 to 0. While the programming is straightforward, it involves some things that you will probably find unfamiliar.
If #2 is what you want, the programming is very easy.
Or did you want the servo action to be something else? Remember that computers are not very clever, and you have to be extremely precise in how you describe what you want them to do.