#include <Servo.h>
Servo myServo;
int val;
void setup() {
myServo.attach(6);
Serial.begin(9600);
}
void loop() {
val = analogRead(A0);
int servoPos = map(val, 0, 1023, 0, 180);
Serial.println(servoPos);
myServo.write(servoPos);
delay (15);
}