Skip to main content

ESP-IDF Basics - Assign. 1.1

··3 mins·
Table of Contents
WS00A - This article is part of a series.
Part 2: This Article

Create a new project starting from the hello world example and change the displayed string (Guided).

Assignment steps
#

In this assignment you will:

  1. Create a new project starting from the hello_world example
  2. Change the displayed string.
In this workshop, we’ll be using ESP-IDF Extension for VS Code. If you didn’t install it yet, please follow these instructions.

Step 1: Create a new project starting from the hello_world example
#

In this section, we will:

  1. Create a new project from an example
  2. Build the project
  3. Flash and monitor

Please note that most commands in VS Code are executed through the Command Palette, which you can open by pressing Ctrl+Shift+P (or Cmd+Shift+P)

In this guide, commands to enter in the Command Palette are marked with the symbol >. Usually it is sufficient to type a few character of the command, then a dropdown menu will help you find the right one.

Create a new project from an example
#

  1. Open VS Code
  2. > ESP-IDF: Show Example Project
  3. (If asked) Choose the ESP-IDF version
  4. Click on get_startedhello_world
  5. Click on the button Select Location for Creating hello_world Example in the new tab.
Fig.1 - Create new project tab

Fig.1 - Create new project tab

A new window will open with the following file structure:

Fig.2 - hello_world example files

Fig.2 - hello_world example files

For now, you can ignore the folders .vscode, .devcontainer, and build. You will work on the main/hello_world_main.c file.

Build the project
#

To compile (build) your project, you first need to tell the compiler which core (called target) you are using. You can do it through the IDE as follows:

  • > ESP-IDF: Set Espressif Device Target
  • In the dropdown menu, choose esp32c3ESP32-C3 chip (via builtin USB-JTAG)

Now you’re ready to compile your project:

  • > ESP-IDF: Build Your Project You can also click on the small 🔧 icon located in the bottom bar

A terminal tab will open at the bottom of your IDE and show the successful compilation and size of the compiled binary.

Fig.3 - Compilation result

Fig.3 - Compilation result

If you have problems that are hard to debug, it is useful to do a full clean of your project by using the command > ESP-IDF: Full clean project.

Flash and monitor
#

To see the firmware running, you need to store it on the device (flash) and then you need to read the output it emits on the serial port (monitor).

  • Connect the board to your workstation
  • Check that the device is recognized
    If you don’t know how, check this guide
  • Note the name assigned to the Espressif device
    • On Windows, it starts with COM
    • On Linux/macOS, it starts with tty or ttyUSB
  • Inform the IDE about the port the board is connected at
    > ESP-IDF: Select Port to Use (COM, tty, usbserial)
If you’re having trouble, check the Establish Serial Connection with ESP32 Guide.

Now you can flash and monitor your device.

  • > ESP-IDF: Build, Flash and Start a Monitor on Your Device
  • If a dropdown menu appears, choose UART

In the terminal, you should now see the Hello World! string and the countdown before the reset.

Step 2: Change the displayed string
#

Identify the output string and change it to Hello LED.

Conclusion
#

You can now create a new project and flash it on the board. In the next assignment, we’ll consolidate this process.

Next step
#

Next assignment → Assignment 1.2

Or go back to navigation menu

WS00A - This article is part of a series.
Part 2: This Article

Related

ESP-IDF Basics - Assign. 1.2

··2 mins
Create a new project from the blink example and change the output GPIO pin via menuconfig