Controlling from the web

Tune your PCA9685

Connect your PCA9685 to your Pi and connect a servo and an LED with 330 &Ohm; resistor to the PCA9685. (I'm using pin 0 for LED and pin 15 for the servo.) Tune your PCA9685 using the Adafruit library. You will want to set the frequency to 50 Hz, but you need to figure out the ranges of values that can be sent with the set_pwm module.

Interrupting for a minute

Simple CGI PCA9685

Write a couple of Python scripts, say min_pos.cgi and max_pos.cgi in CGI style that move the servo to either the minimum of maximum value. Once you get these working, move them to your CGI directory.

Testing CGI forms

Look the documention for the Python cgi library. Write a script that receives data of the form position=n where n is an integer. Your script should return the JSON object {"position":n} when n is a legal position as determined in the previous step. Otherwise, have it return something like "bad argument" or None or false.

You can test your CGI using an HTML form or call it with JavaScript or you can just type a special URL directly into your browser, something like http://www.cs.unca.edu/brock/scripts/underpants.cgi?name=John+Doe

Now put it all together

Merge the two CGI scripts into one so that you can move the servo over the network.