This example is used as the development playground for the TMP-API library —
we use it to develop and test the API.
Overview: The TEST-API example demonstrates how to use TMP-API to create
a small HTTP-based robot server on an ESP32-S3. The example exposes a few
runtime variables (RGB color and brightness) through the API and shows how to
enable OTA updates.
What the example does:
- Starts a
TMP_RobotServeron port 80. - Connects to Wi‑Fi using credentials from
config/secrets.ini. - Enables OTA uploads protected by an
OTA_PASSWORD. - Registers variables
red,green,blue, andbrightnesswhich are writable via the API. - Drives a single NeoPixel LED using the registered variables in the main loop.
Key files in TEST-API:
src/main.cpp— Shows how to initializeTMP_RobotServer, register variables, enable OTA, and update the NeoPixel.platformio.ini— Project configuration and build environments (USB and OTA). It references this library via a local symlink dependency:symlink://../TMP-API.config/secrets.ini.dist— Template for required secrets (Wi‑Fi SSID, Wi‑Fi password, andota_upload_password). Copy this toconfig/secrets.iniand fill in real values before building.
Variables exposed by the example
red(0-255): red channel valuegreen(0-255): green channel valueblue(0-255): blue channel valuebrightness(0-255): global LED brightness
These variables are registered in main.cpp and will be exposed by the TMP-API
server. The implementation exposes them over HTTP so they can be read and updated
remotely (see TEST-API code for exact endpoints and UI if provided).
How to run the example (PlatformIO):
-
Copy the secrets template and fill your credentials:
cp TEST-API/config/secrets.ini.dist TEST-API/config/secrets.ini
Edit
TEST-API/config/secrets.iniand setwifi_ssid,wifi_password, andota_upload_password. -
Build and upload over USB:
platformio run -e esp32_s3_devkitc_1_usb -t upload
-
Or upload over OTA (device must be on the same network and
upload_portset inplatformio.ini):platformio run -e esp32_s3_devkitc_1_ota -t upload
-
Use the debug environments to enable extra debug logging:
platformio run -e debug_esp32_s3_devkitc_1_usb -t upload
See the TMP-API repository for more
details on the API and how to use it in your own projects!