Atsumi Toda / Mbed 2 deprecated DFplayer

Dependencies:   mbed

Revision:
0:5ce6ec9465a4
diff -r 000000000000 -r 5ce6ec9465a4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Dec 30 08:35:51 2019 +0000
@@ -0,0 +1,107 @@
+/*
+//音システム用
+DigitalOut soundsystem1(p19);  lpc1114 dp25 d1
+DigitalOut soundsystem2(p24);          dp26 d2
+DigitalOut soundsystem3(p25);          dp27 d3
+*/
+
+#include "mbed.h"
+
+Serial mp3(USBTX,USBRX);
+
+DigitalIn d1 (dp25);
+DigitalIn d2 (dp26);
+DigitalIn d3 (dp27);
+
+
+DigitalOut myled(LED1);
+
+int main() {
+    wait(3.0);
+    //起動コマンド//
+    mp3.putc(0x7E);
+    mp3.putc(0xFF);
+    mp3.putc(0x06);
+    mp3.putc(0x09);
+    mp3.putc(0x00);
+    mp3.putc(0x00);
+    mp3.putc(0x01);
+    mp3.putc(0xEF);
+    //=================//
+    wait(0.3);
+    
+    //=======================================//
+     mp3.putc(0x7E);
+    mp3.putc(0xFF);
+    mp3.putc(0x06);
+    mp3.putc(0x0F);//「フォルダ指定再生コマンド」
+    mp3.putc(0x00);
+    mp3.putc(0x01);//フォルダー名を指定。ここでは「01」
+    mp3.putc(0x01);//ファイル名を指定。ここでは「001.mp3」
+    mp3.putc(0xEF);
+//==================================================/
+    wait(9.0);
+
+    while(1) {
+        
+        if((d1==0)&(d2==1)&(d3==1)){
+          wait(0.030);
+                 //=================高度警報音声============================//   
+                  /*     
+                    soundsystem1=0;
+                    soundsystem2=1;
+                    soundsystem3=1;
+                            
+                 */
+                    mp3.putc(0x7E);
+                    mp3.putc(0xFF);
+                    mp3.putc(0x06);
+                    mp3.putc(0x0F);//「フォルダ指定再生コマンド」
+                    mp3.putc(0x00);//no feedback
+                    mp3.putc(0x01);//フォルダー名を指定。ここでは「01」
+                    mp3.putc(0x02);//ファイル名を指定。ここでは「002.mp3」
+                    mp3.putc(0xEF);
+                    
+                    wait(3.5);  
+               }else if((d1==1)&(d2==1)&(d3==1)){
+                    //=================経過時間音声============================//
+                    mp3.putc(0x7E);
+                    mp3.putc(0xFF);
+                    mp3.putc(0x06);
+                    mp3.putc(0x0F);//「フォルダ指定再生コマンド」
+                    mp3.putc(0x00);
+                    mp3.putc(0x01);//フォルダー名を指定。ここでは「01」
+                    mp3.putc(0x01);//ファイル名を指定。ここでは「001.mp3」
+                    mp3.putc(0xEF);
+                    
+                    wait(2.0);  
+                   
+                    
+    
+                }//if ends
+                
+    }//while ends
+}//int main ends
+    
+  
+
+    /*  
+       mp3.putc(0x7E);
+    mp3.putc(0xFF);
+    mp3.putc(0x06);
+    mp3.putc(0x01);////次曲再生コマンド
+    mp3.putc(0x00);
+    mp3.putc(0x00);//
+    mp3.putc(0x00);//
+    mp3.putc(0xEF);
+    */
+    /*
+     mp3.putc(0x7E);
+        mp3.putc(0xFF);
+        mp3.putc(0x06);
+        mp3.putc(0x0E); //ポーズCMD
+        mp3.putc(0x00);
+        mp3.putc(0x00); //
+        mp3.putc(0x00); //
+        mp3.putc(0xEF);
+        */
\ No newline at end of file