#include Servo esc; // Create a servo object to control the ESC int ledPin = 2; // LED pin void setup() { esc.attach(1); // Attach ESC signal to pin 9 pinMode(ledPin, OUTPUT); // Set LED pin as output esc.writeMicroseconds(2000); // Send 1000us pulse width delay(2000); esc.writeMicroseconds(1000); // Send 1000us pulse width delay(1000); } void loop() { // Arm the ESC esc.writeMicroseconds(1000); // Send 1000us pulse width digitalWrite(ledPin, HIGH); // Turn on LED delay(2000); // Wait for ESC to arm // Increase throttle gradually for (int throttle = 1000; throttle <= 2000; throttle += 10) { esc.writeMicroseconds(throttle); // Set throttle delay(20); // Delay between increments } delay(2000); // Hold throttle at maximum // Decrease throttle gradually for (int throttle = 2000; throttle >= 1000; throttle -= 10) { esc.writeMicroseconds(throttle); // Set throttle delay(20); // Delay between decrements } esc.writeMicroseconds(1000); // Set throttle back to minimum digitalWrite(ledPin, LOW); // Turn off LED delay(2000); // Wait before repeating }