#include <Servo.h>
Servo s1;
void setup() {
// put your setup code here, to run once:
pinMode(A0, INPUT);
s1.attach(3);
}
void loop() {
// put your main code here, to run repeatedly:
int x=analogRead(A0);
int y=map(x,0,1023,0,180);
if(x<512){
s1.write(y);
}
else{
s1.write(y);
}
}