#include <Servo.h>
Servo ESC;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
ESC.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds)
ESC.writeMicroseconds(1000);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A2);
int sped = map(sensorValue, 0, 1023, 1000, 2000);
Serial.println(sped);
ESC.writeMicroseconds(sped);
delay(5);
}