sparkfun joystick shield help with arduino

Hola, I have a sparkfun joystick shield "Joystick Shield Kit Retail - RTL-09895 - SparkFun Electronics". I am trying to understand how I would use it to control a servo motor. I don't get how I would make that work, the code portion. So my setup is arduino w/ joystick shield on it, then the servo I am not sure what to do with. My end goal is to have the joystick make the servo turn with the movements. (I.E move joystick left and the servo turns left.) Thanks so much!

The joystick returns a range of values as you move it from hard left to hard right. Interestingly enough, the servo has hard limits, too.

If you map the joystick range of value to the servo range of values, you can read the joystick value, and drive the servo to the mapped position (use map() to do the mapping).

Some servo/pot test code.

//zoomkat dual pot/servo test 12-29-12
//view output using the serial monitor

#include <Servo.h> 
Servo myservoS1;
Servo myservoS2;

int potpinS1 = 0;  //analog input pin A0
int potpinS2 = 1;

int newvalS1, oldvalS1;
int newvalS2, oldvalS2;

void setup() 
  Serial.println("testing dual pot servo");  

void loop() 
  newvalS1 = analogRead(potpinS1);           
  newvalS1 = map(newvalS1, 0, 1023, 0, 179); 
  if (newvalS1 < (oldvalS1-2) || newvalS1 > (oldvalS1+2)){  
    Serial.print("1- ");

  newvalS2 = analogRead(potpinS2);
  newvalS2 = map(newvalS2, 0, 1023, 0, 179);
  if (newvalS2 < (oldvalS2-2) || newvalS2 > (oldvalS2+2)){  
    Serial.print("2- ");    
  delay(50); //slow down looping to better read serial monitor