# ESP-BOX Example This example shows how to use the `espp::EspBox` hardware abstraction component to automatically detect and initialize components on both the ESP32-S3-BOX and the ESP32-S3-BOX-3. It initializes the touch, display, and audio subsystems. It reads the touchpad state and each time you touch the scren it 1) uses LVGL to draw a circle where you touch, and 2) play a click sound (wav file bundled with the firmware). If you press the home button on the display, it will clear the circles. The on-screen audio row (bottom-left) exercises the microphones and speaker in full duplex: the record button records from the dual microphone array (ES7210) into a PSRAM-preferred buffer, the play button streams the recording back through the speaker, and the remaining buttons adjust the speaker and microphone volumes (shown in the label above the row). The measured effective capture rate is logged when a recording stops. Because the board's speaker is mono, the recorded stereo (mic 1 / mic 2) is downmixed to both channels before playback, and the per-channel peak amplitude is logged so you can tell a silent capture (peak near 0) from a playback issue. https://github.com/user-attachments/assets/6fc9ce02-fdae-4f36-9ee7-3a6c347ca1c4 https://github.com/esp-cpp/espp/assets/213467/d5379983-9bc2-4d56-a9fc-9e37f54af15e    ## Configuration notes This example raises some espp BSP task stack sizes above their component defaults via `sdkconfig.defaults`, because the example does more work in those tasks than the defaults assume: - **Interrupt / touch task stack (`CONFIG_ESP_BOX_INTERRUPT_STACK_SIZE` = 8192, up from the 4 KB BSP default).** The interrupt task services the touch controller over I2C; if an I2C transaction errors, the error is logged through espp's `fmt`-based (colorized) logger, whose formatting path needs several KB of stack. With only 4 KB this can overflow and corrupt memory. If you base your own project on this example (or reproduce its functionality), keep this override in your `sdkconfig` / `sdkconfig.defaults`. The example also enables `CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK`, which turns any future task-stack overflow into an immediate, clearly-named panic instead of silent heap corruption. ## How to use example ### Hardware Required This example is designed to run on the ESP32-S3-BOX or ESP32-S3-BOX-3. ### Build and Flash Build the project and flash it to the board, then run monitor tool to view serial output: ``` idf.py -p PORT flash monitor ``` (Replace PORT with the name of the serial port to use.) (To exit the serial monitor, type ``Ctrl-]``.) See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. ## Example Output BOX3:  BOX:  Slow rotation video: https://github.com/user-attachments/assets/6fc9ce02-fdae-4f36-9ee7-3a6c347ca1c4 Fast rotation video: https://github.com/user-attachments/assets/64fd1d71-d6b2-4c4f-8538-4097d4d162e9 Pictures showing the new gravity vector pointing down from the center of the screen:  
To create a project from this example, run:
idf.py create-project-from-example "espp/esp-box=1.1.7:example"