Poor Teaching Ardunino Mega Board with a Hitec HS-311 Standard Servo Motor

Hello.

Started a small course as a hobby the other day using the Arduino Mega Board. I am building a circuit with a 10K pot and Hitec HS-311 Standard Servo Motor . Now was not really given much in way of instructtion other then use the web. Been looking around and have come across no wire sch. any where for this set up. Was also told that a flow chat was needed for this project??? What is this. I have found some things on the net but the programs do not seems to work or they make no sence to me. What needs to happen is I need to write a sketch to light a green LED only at positions 0 degrees or 180 degrees , any other position it must light the red LED If you can point me in the right right direction that would be great. Best Regards

so in short what I am looking for for help with is how to wire my Arduino Board to my servo motor and to bread board since I have no wire diagram. and a way to make a flow chart to the code. Thank you

A good source of material is the Playground.

In the arduino IDE you can go to examples > servo > knob to find example code that might help. Below is a suggested way to wire a servo. Note that the arduino usually doesn't have sufficient power in itself to power a larger servo.