Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DFPlayerMini
main.cpp
00001 #include "mbed.h" 00002 #include "DFPlayerMini.h" 00003 00004 DigitalOut myled(LED1); //LED 00005 DigitalIn sw(dp1); //再生ボタン 00006 00007 DFPlayerMini mp3(dp16, dp15); 00008 DigitalIn busy(dp17); //DFPlayerMiniのBUSYと接続する 00009 00010 int main() { 00011 mp3.mp3_set_volume(30); //再生音量を設定する30が最大 00012 00013 while(1) 00014 { 00015 if( sw == 1 ) 00016 { 00017 myled = 1; //LED点灯 00018 mp3.mp3_play(0001); //0001.mp3を再生 00019 wait(0.1); 00020 00021 //再生が終わるまで待つ 00022 while( busy == 0 ) 00023 { 00024 wait(0.1); 00025 } 00026 } 00027 00028 //LEDを点滅させる 00029 myled = !myled; 00030 wait(0.2); 00031 } 00032 }
Generated on Thu Jul 14 2022 09:24:36 by
1.7.2