#include <Servo.h>
Servo myservo; // create servo object to control a servo
float value=0;
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(11); // attaches the servo on pin 9 to the servo object
pinMode(7, INPUT);
}
void loop() {
value=analogRead(2);
value=(value/1023)*180;
myservo.write(value);
}