ESP32 with PlatformIO project structure

ESP32 with PlatformIO project structure

Explorer

  • .git…
  • .pio…, not committed
  • .vscode
  • extensions.json
  • c_cpp_properties.json, not committed
  • launch.json, not committed
  • datanew
  • index.htmlnew
  • app.jsnew
  • style.cssnew
  • defaults.jsonnew
  • docsnew
  • wiring.mdnew
  • mqtt-topics.mdnew
  • include
  • README
  • pins.hnew
  • config.hnew
  • secrets.hnew, not committed
  • secrets.example.hnew
  • lib
  • README
  • src
  • main.cpp
  • test
  • README
  • .clang-formatnew
  • .pre-commit-config.yamlnew
  • .gitignore
  • LICENSEnew
  • README.md
  • compile_commands.jsonnew, not committed
  • platformio.ini
  1. # Install PlatformIO Core (or install the pioarduino IDE extension in VS Code)

    pipx install platformio
  2. # Install the pioarduino platform, which brings Arduino core 3.x

    pio pkg install --global --platform "https://github.com/pioarduino/platform-espressif32/releases/download/55.03.312-1/platform-espressif32.zip"
  3. # Create the project for your board with sample code and VS Code files

    pio project init --board esp32-s3-devkitc-1 --ide vscode --sample-code -O "platform=https://github.com/pioarduino/platform-espressif32/releases/download/55.03.312-1/platform-espressif32.zip" -O "framework=arduino"
  4. # Build, upload over USB and open the serial monitor

    pio run -t upload -t monitor
  5. # Upload the web files in data/ to the LittleFS partition

    pio run -t uploadfs
  6. # Run the host unit tests (no board needed)

    pio test -e native
  7. # Run static analysis with cppcheck and clang-tidy

    pio check -e esp32s3