Development Guide

This guide covers all aspects of developing with the ESP32 Distance Sensor, from setting up your environment to debugging and testing.

Getting Started

Testing Without Hardware

Use QEMU emulation:

# Build the project
idf.py build

# Run in QEMU with network support
./tools/run-qemu-network.sh

# Debug in QEMU
# Press F5 in VS Code or use Debug panel

Flashing Real Hardware

When you have physical ESP32:

# Build the project
idf.py build

# Flash and monitor (replace /dev/ttyUSB0 with your port)
idf.py -p /dev/ttyUSB0 flash monitor

# Exit monitor: Press Ctrl+]

Development Workflow

Typical development cycle:

# 1. Customize application
vim main/main.c

# 2. Build
idf.py build

# 3. Test in QEMU (optional)
./tools/run-qemu-network.sh

# 4. Flash to hardware
idf.py -p /dev/ttyUSB0 flash monitor

Template Benefits

  • Consistent Environment: Same toolchain everywhere (Codespaces, Docker, CI/CD)

  • ESP-IDF v5.4.1: Latest stable version pre-configured

  • QEMU Support: Test without hardware using full network emulation

  • GDB Debugging: Full breakpoint debugging in emulator

  • Web Interface: Access emulated web server via browser

  • Documentation: Professional requirements engineering with Sphinx-Needs

Next Steps

Known Issues

Note

ESP-IDF-WEB extension doesn’t automatically install in Codespaces. Please search for “ESP-IDF Web” in the VS Code marketplace and install it manually.