Skip to content

My Drone, My Definition

In this project, you will learn how to modify the drone’s code, including takeoff sound effects, motor speed, and LED lighting effects, to deeply understand the drone’s code structure.

  • C language arrays and macros
  • ESP-IDF project structure
  • Code compilation and flashing process
  • Buzzer, LED, and motor control
Item Quantity Notes
ESP32-S3 Drone 1 Fully assembled
Computer 1 With VS Code + ESP-IDF plugin installed
USB Cable 1 For programming
  1. Extract starter_code.zip
  2. Open the folder with VS Code

Understand the project’s file organization:

File Function
main.c Main function, controls flight flow
buzzer.c Buzzer control, handles sound effects
led.c LED control, handles lighting effects
motors.c Motor control, handles speed

Open buzzer.c and find the tone array:

// Original code: takeoff sound
uint16_t tone[] = {440, 880, 440, 0}; // A4, A5, A4, silence

Change it to the first two lines of “Ode to Joy”:

uint16_t tone[] = {330, 330, 392, 392, 440, 440, 392, 0}; // E4, E4, G4, G4, A4, A4, G4, silence

Open motors.c and find the MOTORS_TEST_RATIO macro:

#define MOTORS_TEST_RATIO (uint16_t)(0.2*(1<<16)) // 20% speed

Change it to 30% speed:

#define MOTORS_TEST_RATIO (uint16_t)(0.3*(1<<16)) // 30% speed
  1. Press F1, type ESP-IDF: Build to compile the project
  2. Press F1, type ESP-IDF: Flash to flash to the drone
  1. Power on and listen if the takeoff sound has changed
  2. Press the test button to see if the motor speed is faster
  • Check if ESP-IDF environment is properly installed
  • Ensure there are no syntax errors in the code
  • Check USB connection
  • Confirm drivers are installed

Congratulations! You have successfully modified the drone’s code and understood the basic code structure. This is the first step to becoming a flight engineer!

In the next project, you will learn how to adjust PID parameters to make the drone fly more stably.

First published atdrone.imagrove.com/intermediate/customization/Please credit Imagrove and link back to this page when quoting or republishing.

Questions or issues with this tutorial?

Sign in with GitHub to leave a comment. If a step fails for you, tell us — we verify it and update the tutorial.

ImagroveMore ESP32 tutorials · ESP32 IoT Tutorial

© 2026 ESP32 Drone. All rights reserved.