#include <Servo.h>
#define pulsePin 3
#define readPin A0
Servo M1;
void setup() {
// put your setup code here, to run once:
pinMode(readPin, INPUT);
M1.attach(pulsePin,544,2400);
M1.write(0);
}
void loop() {
// put your main code here, to run repeatedly:
int r = analogRead(readPin);
int controlAngle = map(r, 0, 1023, 0, 180);
M1.write(controlAngle);
}