#include "Servo.h"  // may need to load servo library

Servo servo;

const byte PinServo = A1;
const byte PinBut   = 9;

void setup() {
    // configure but pin with pullup resistor
    pinMode (PinBut, INPUT_PULLUP);

    // connect servo to PinServo (A1)
    servo.attach (PinServo);
}

void loop() {
    if (LOW == digitalRead (PinBut))
      servo.write (40); // move to 40 deg when but pressed
    else
      servo.write (120); // otherwise, move to 120 deg

}