A protocol for creating a new IoT LED controller project from scratch, including setting up the folder structure, initializing PlatformIO for the firmware, and setting up a React/Vite project for the web UI.
As an AI assistant, your goal is to create a new, fully structured project for an IoT LED controller with a web-based UI. When the user asks to "create a new LED controller project" or similar, follow this protocol.
If this workflow is executed in a repository that uses a project virtual environment, run PlatformIO/project Python commands with:
source .venv/bin/activate && <command>
esp32dev for an ESP32. Also support esp32-c3-devkitm-1, esp32-s3-devkitc-1, and esp32-c6-devkitc-1 as common ESP-IDF options.Execute the following commands to create the necessary directories.
mkdir <project-name>
cd <project-name>
mkdir src
mkdir web
mkdir scripts
source .venv/bin/activate && platformio project init --board esp32dev
This will create platformio.ini and other necessary files.main.cpp: Create a placeholder src/main.cpp file with a minimal Arduino sketch.
#include <Arduino.h>
void setup() {
Serial.begin(115200);
Serial.println("Hello from the new project!");
}
void loop() {
delay(1000);
}
web directory.
npm create vite@latest web -- --template react
npm install --prefix web
embed_assets.py: Create a placeholder Python script in the scripts/ directory. This script will eventually be used to embed the web UI into the firmware.
# scripts/embed_assets.py
print("This script will be used to embed the web assets.")
# TODO: Implement the logic to convert web/dist files into C++ headers.
src directory."cd web and run npm run dev."source .venv/bin/activate && python scripts/embed_assets.py before deploying the firmware."