![](/media/cache/profiles/f0fcf351df4eb6786e9bb6fc4e2dee02.jpg.50x50_q85.jpg)
Test program for UART MP3 Voice Module with 8MB Flash Memory / DFR0534
see /users/kenjiArai/notebook/mp3--voice-module-dfr0534/
Revision 0:27b9f229cbaf, committed 2019-12-29
- Comitter:
- kenjiArai
- Date:
- Sun Dec 29 04:13:19 2019 +0000
- Commit message:
- MP3, DRF0534 test program
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MP3_DFR0534.lib Sun Dec 29 04:13:19 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/kenjiArai/code/MP3_DFR0534/#466200f304c9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_revision.cpp Sun Dec 29 04:13:19 2019 +0000 @@ -0,0 +1,20 @@ +/* + * Check Mbed revision + * + * Copyright (c) 2019 Kenji Arai / JH1PJL + * http://www.page.sannet.ne.jp/kenjia/index.html + * https://os.mbed.com/users/kenjiArai/ + * Created: December 24th, 2019 + */ + +#include "mbed.h" + +// RUN ONLY ON mbed-os5.15.0 +// https://github.com/ARMmbed/mbed-os/releases/tag/mbed-os-5.15.0 +#if (MBED_MAJOR_VERSION == 5) &&\ + (MBED_MINOR_VERSION == 15) &&\ + (MBED_PATCH_VERSION == 0) +#else + //#warning "Please use Mbed-os5.15.0" + #error "Please use Mbed-os5.15.0" +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 29 04:13:19 2019 +0000 @@ -0,0 +1,73 @@ +/* + * Mbed Application program + * UART MP3 Voice Module with 8MB Flash Memory / DFR0534 + * + * Copyright (c) 2019 Kenji Arai / JH1PJL + * http://www.page.sannet.ne.jp/kenjia/index.html + * https://os.mbed.com/users/kenjiArai/ + * Created: December 27th, 2019 + * Revised: December 29th, 2019 + */ + +/* + Reference information: + http://akizukidenshi.com/catalog/g/gM-13708/ + https://wiki.dfrobot.com/Voice_Module_SKU__DFR0534 + + Tested on + Nucleo-F446RE + */ + +// Include -------------------------------------------------------------------- +#include "mbed.h" +#include "drf0534.h" + +// Definition ----------------------------------------------------------------- +#define USE_VOL 1 + +// Constructor ---------------------------------------------------------------- +Serial pc(USBTX, USBRX); +DFR0534 mp3(PA_0, PA_1, PA_4); // tx, rx, busy +#if USE_VOL +AnalogIn pot(A5); +#endif + +// RAM ------------------------------------------------------------------------ +char name_buf[32]; + +// ROM / Constant data -------------------------------------------------------- + +// Function prototypes -------------------------------------------------------- + +//------------------------------------------------------------------------------ +// Control Program +//------------------------------------------------------------------------------ +int main() +{ + pc.printf("Start DRF0534 UART MP3 Voice Module\r\n"); + // Set Volume + mp3.volume_setting(VOL_MAX / 2); + mp3.command(Increase_the_volume); // another way + // Check total MP3 files + uint32_t num = mp3.total_num_of_audio(); + pc.printf("Number of audio source = %u\r\n", num); + // Try specific MP3 + mp3.play_one(2); + while(true) { + for (uint32_t i = 1; i < num + 1; i++) { +#if USE_VOL + float an = pot.read(); + an *= VOL_MAX; + mp3.volume_setting((uint8_t)an); + pc.printf("VOL = %3.0f, ", an); // 0 to 30(VOL_MAX) +#endif + // play one track + mp3.play_one(i); + // get file name + mp3.get_file_name(name_buf); + pc.printf("Current # of audio = %u, ", mp3.current_num_of_audio()); + pc.printf("File name = %s, ", name_buf); + pc.printf("playing time = %d [sec]\r\n", mp3.get_play_time()); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Sun Dec 29 04:13:19 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#64853b354fa188bfe8dbd51e78771213c7ed37f7