# 14.Play MP3

มีตัวอย่างชื่อ **testMP3** ในไดเร็กทอรีไฟล์ "OpenCatEsp32/ModuleTests" หน้าที่หลักของตัวอย่างนี้คือการเล่นไฟล์ .mp3 ที่จัดเก็บไว้ในระบบไฟล์ SPIFFS ผู้ใช้สามารถเลือกเล่นไฟล์ .mp3 ต่างๆ ได้โดยการป้อนตัวเลข 0\~6 (หมายเลขดัชนีไฟล์ .mp3) ในจอภาพอนุกรม

ก่อนคอมไพล์ตัวอย่าง [download, install and configure the software environment](https://docs.petoi.com/thai/biboard/demo-applications/pages/-MVugl3T-mwZYPFHdZ3c#3.2.1-set-up-esp32-development-environment) ([Arduino IDE 1.8.\*](https://www.arduino.cc/en/software)*, development board esp32 2.0.\**, library [ESP8266Audio 1.9.7](https://www.arduino.cc/reference/en/libraries/esp8266audio/), [partition configuration BiBoard V0](https://app.gitbook.com/o/-M-_eWZUjFA4usjshHcZ/s/-MQ6a951Q6Jn1Zzt5Ajr-887967055/~/changes/0wTYGtIeSMImmLXG2XJn/biboard/demo-applications/13.add-hardware-partition-configuration-option-in-arduino-ide)).

หลังจากคอมไพล์แล้ว ให้ใช้ปลั๊กอินอัปโหลดไฟล์ SPIFFS ล่าสุดเพื่ออัปโหลดไฟล์ .mp3 ไปยังพาร์ติชันระบบไฟล์ SPIFFS ของ BiBoard สำหรับรายละเอียด โปรดดูบทที่ [File System SPIFFS](https://docs.petoi.com/biboard/demo-applications/12.file-system-spiffs).

{% hint style="info" %}
หมายเหตุ:

* Arduino IDE 2.0 **ไม่สามารถ**เพิ่มตัวเลือกการกำหนดค่า large\_spiffs\_16MB (4.5MB APP with OTA/6.93MB SPIFFS) ได้ในขณะนี้
* ปลั๊กอินอัปโหลดไฟล์ [SPIFFS file upload plugin](https://github.com/me-no-dev/arduino-esp32fs-plugin/releases/tag/1.0) ใน Arduino IDE 1.8.\* เขียนด้วยภาษาจาวา และ Arduino IDE 2.0 เขียนด้วยภาษาอื่น (TypeScript + Golang) ดังนั้นปลั๊กอินอัปโหลดก่อนหน้านี้จึงไม่สามารถใช้ใน Arduino IDE 2.0 ได้ ขณะนี้ยังไม่รองรับปลั๊กอินอัปโหลดไฟล์ Arduino IDE 2.0 SPIFFS

ดังนั้นขอแนะนำให้คุณติดตั้งและใช้ [Arduino IDE 1.8.\* IDE](https://www.arduino.cc/en/software) ชั่วคราวเพื่ออัปโหลดไฟล์ร่างและ .mp3

แน่นอน คุณยังสามารถใช้ VS Code + PlatformIO เพื่ออัปโหลดไฟล์ร่างและ .mp3 สำหรับรายละเอียด โปรดดูเอกสารต่อไปนี้:

[Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)](https://randomnerdtutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/#2)

[ESP32 with VS Code and PlatformIO: Upload Files to Filesystem (SPIFFS)](https://randomnerdtutorials.com/esp32-vs-code-platformio-spiffs/)

ก่อนอัปโหลดไฟล์ร่างและ .mp3 โปรดย้ายโฟลเดอร์ "data" ไปยังไดเร็กทอรีรูท(root)ของโปรเจ็กต์ จัดเก็บไฟล์โค้ดในไดเร็กทอรี "src" และกำหนดค่าตัวเลือกพาร์ติชัน "board\_build.partitions" ใน **platformio.ini** ใน ไดเร็กทอรีรูทของโปรเจ็กต์ดังแสดงในรูปต่อไปนี้:

![](/files/xqqVHzSvwvayS9MEexKg)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/thai/biboard/demo-applications/14.play-mp3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
