#include <Servo.h>
Servo myservo;
void setup() {
Serial.begin(9600);
myservo.attach(5);
pinMode(A0,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(A0);
myservo.write(map(sensorValue, 0, 1023, 0, 180)); // tell servo to go to position in variable ‘pos’
Serial.println(sensorValue);
delay(1);
}