The servo code has been updated to include sweeping capabilities and
worry-free C functions which take care of bounds checking and
conversion from radian and degree arguments to servo pulse width.  Now
you can more safely use servos to control steering, actuate arms, or
search out your opponent with ease.  For a demonstration, load ic and
type: C> load servotst2.c, and if you're confused about how to use
these servo functions, take a look at this program (in
/mit/6.270/lib/ic).

Using the new interface, you will not have to worry about the servo
trying to "kill itself" due to bad pulse widths, or worry about the
meaning of "servo_pulse_wavetime" any longer.  The following functions
load automatically when you run ic:

int servo_on(int dummy)  and
int servo_off(int dummy)
	Turn the servo on and off.  They take a dummy variable and 
	return a dummy variable.  Starred functions are enabled and
	disabled using these two functions.

MOVEMENT FUNCTIONS:
int servo_deg(float angle) *
	Takes an argument in degrees, checks the bounds, moves servo 
	to the desired position, and returns the corresponding pulse
	width.  Input range is 0. to 180., output range is 700 to 4400.

int servo_rad(float angle) *
	Like above, but takes an argument in radians.  Range is 0. to PI.

int servo(int period) *
	Takes an argument in clock cycles of pulse, does bounds checking,
	and moves the servo to that position.  Range is 700 to 4400.
	This can be used with the following conversion functions:

CONVERSION FUNCTIONS:
int degree_to_pulse(float angle) and
int radian_to_pulse(float angle) 
	Take an argument in degrees or radians and return the 
	corresponding servo pulse width.

SERVO SWEEPING COMMANDS:
void servo_sweep(int pulse_min,int pulse_max) 
	Takes arguments of the minimum pulse width and maximum pulse
	width of the sweep, checks the bounds, and causes the servo 
	to start sweeping from min to max to min, etc.  This too can
	be used with the conversion functions to obtain pulse widths
	as: 

		servo_sweep(degree_to_pulse(0.),degree_to_pulse(180.));
	or	servo_sweep(radian_to_pulse(0.),radian_to_pulse(3.14));

	both of which cause the servo to sweep 180 degrees and back.
	Basically the same thing can be accomplished by setting the 
	global variable "servo_inc" (the number of clock cycles that 
	servo_pulse_wavetime is incremented each 20ms) to have a value 
	other than 0, but this is not recommended now as increments of 
	less than 125 lead to jerky motion and servo_sweep lets you 
	safely set the angles at which it changes direction.

	Servo_sweep() sets up the sweeping which runs in the background.
	To find out what angle the servo is at and store it in a variable,
	use:   int angle=servo_pulse_wavetime;  This is in units of 
	the width of the servo pulse in clock cycles. The range is 700
	to 4400.

void stop_sweep() 
	Stops the servo from sweeping and leaves it at its current 
	position.


* These functions only have an effect if servo_on(0) has been earlier
  called to turn the servo on.  servo_off(0) is used to turn the servo
  of.
