Petoi Doc Center
🇺🇸English
Search…
⌃K

14.Play MP3

There is a demo named testMP3 in the "OpenCatEsp32/ModuleTests" file directory. The main function of this demo is to play .mp3 files stored in the SPIFFS file system. Users can choose to play different .mp3 files by inputting 0~6 numbers (.mp3 file index number) in the serial monitor.
After compiling, use the latest SPIFFS file upload plugin to upload the .mp3 file to the SPIFFS file system partition of BiBoard. For details, please refer to the chapter File System SPIFFS.
Note:
  • Arduino IDE 2.0 cannot add the large_spiffs_16MB (4.5MB APP with OTA/6.93MB SPIFFS) configuration option currently.
  • The SPIFFS file upload plugin in Arduino IDE 1.8.* is written in Java. And Arduino IDE 2.0 is written in a different language (TypeScript + Golang), so the previous upload plugin cannot be used in Arduino IDE 2.0. There is no support for the Arduino IDE 2.0 SPIFFS file upload plugin currently.
So it is recommended that you temporarily install and use the Arduino IDE 1.8.* IDE to upload sketch and .mp3 file.
Of course, you can also use VS Code + PlatformIO to upload the sketch and .mp3 files. For details, please refer to the following documents:
Before uploading the sketch and .mp3 files, please move the "data" folder to the project root directory, store the code files in the "src" directory, and configure the partition option "board_build.partitions" in the platformio.ini in the project root directory, as shown in the following figure: