/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: Servo Control - Source Code NOT compiled for: Arduino Nano - Source Code created on: 2024-10-19 12:44:26 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* start servos with throttles minimum for 10s, then */ /* start at 25% power for 45s and after that turn off */ /* servos */ /****** SYSTEM REQUIREMENT 2 *****/ /* two escs connected to specify pins, start with */ /* arming motors and wait 15s with throttles in */ /* minimum positions, then start motors with 25% */ /* speed for 45s a then turn off the motors */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include // https://github.com/arduino-libraries/Servo #include // https://github.com/RB-ENantel/RC_ESC /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF PWM OUTPUT PINS *****/ const uint8_t motor_Servomotor_PWMSignal_PIN_D3 = 3; // Pin for first servo const uint8_t motor2_Servomotor_PWMSignal_PIN_D5 = 5; // Pin for second servo /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/ Servo myServo1; // Instance of Servo class for motor on pin D3 Servo myServo2; // Instance of Servo class for motor on pin D5 ESC myESC1(9, 1000, 2000, 500); // Instance of ESC class for first ESC ESC myESC2(10, 1000, 2000, 500); // Instance of ESC class for second ESC void setup(void) { // Set the PWM pins as outputs pinMode(motor_Servomotor_PWMSignal_PIN_D3, OUTPUT); pinMode(motor2_Servomotor_PWMSignal_PIN_D5, OUTPUT); // Attach the servos to their respective pins myServo1.attach(motor_Servomotor_PWMSignal_PIN_D3); myServo2.attach(motor2_Servomotor_PWMSignal_PIN_D5); // Start ESC calibration for both ESCs myESC1.calib(); myESC2.calib(); // Wait for 15 seconds with minimum throttle for ESCs delay(15000); // Start motors at 25% power for 45 seconds myESC1.write(64); // 25% throttle for first ESC myESC2.write(64); // 25% throttle for second ESC delay(45000); // Run at 25% power for 45 seconds // Stop the motors myESC1.stop(); myESC2.stop(); } void loop(void) { // Main loop does not need to perform any actions }