2018年度の機体、S-240に搭載する予定だった高度警報のプログラムである。
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 /* 00002 //音システム用 00003 DigitalOut soundsystem1(p19); lpc1114 dp25 d1 00004 DigitalOut soundsystem2(p24); dp26 d2 00005 DigitalOut soundsystem3(p25); dp27 d3 00006 */ 00007 00008 #include "mbed.h" 00009 00010 Serial mp3(USBTX,USBRX); 00011 00012 DigitalIn d1 (dp25); 00013 DigitalIn d2 (dp26); 00014 DigitalIn d3 (dp27); 00015 00016 00017 DigitalOut myled(LED1); 00018 00019 int main() { 00020 wait(3.0); 00021 //起動コマンド// 00022 mp3.putc(0x7E); 00023 mp3.putc(0xFF); 00024 mp3.putc(0x06); 00025 mp3.putc(0x09); 00026 mp3.putc(0x00); 00027 mp3.putc(0x00); 00028 mp3.putc(0x01); 00029 mp3.putc(0xEF); 00030 //=================// 00031 wait(0.3); 00032 00033 //=======================================// 00034 mp3.putc(0x7E); 00035 mp3.putc(0xFF); 00036 mp3.putc(0x06); 00037 mp3.putc(0x0F);//「フォルダ指定再生コマンド」 00038 mp3.putc(0x00); 00039 mp3.putc(0x01);//フォルダー名を指定。ここでは「01」 00040 mp3.putc(0x01);//ファイル名を指定。ここでは「001.mp3」 00041 mp3.putc(0xEF); 00042 //==================================================/ 00043 wait(9.0); 00044 00045 while(1) { 00046 00047 if((d1==0)&(d2==1)&(d3==1)){ 00048 wait(0.030); 00049 //=================高度警報音声============================// 00050 /* 00051 soundsystem1=0; 00052 soundsystem2=1; 00053 soundsystem3=1; 00054 00055 */ 00056 mp3.putc(0x7E); 00057 mp3.putc(0xFF); 00058 mp3.putc(0x06); 00059 mp3.putc(0x0F);//「フォルダ指定再生コマンド」 00060 mp3.putc(0x00);//no feedback 00061 mp3.putc(0x01);//フォルダー名を指定。ここでは「01」 00062 mp3.putc(0x02);//ファイル名を指定。ここでは「002.mp3」 00063 mp3.putc(0xEF); 00064 00065 wait(3.5); 00066 }else if((d1==1)&(d2==1)&(d3==1)){ 00067 //=================経過時間音声============================// 00068 mp3.putc(0x7E); 00069 mp3.putc(0xFF); 00070 mp3.putc(0x06); 00071 mp3.putc(0x0F);//「フォルダ指定再生コマンド」 00072 mp3.putc(0x00); 00073 mp3.putc(0x01);//フォルダー名を指定。ここでは「01」 00074 mp3.putc(0x01);//ファイル名を指定。ここでは「001.mp3」 00075 mp3.putc(0xEF); 00076 00077 wait(2.0); 00078 00079 00080 00081 }//if ends 00082 00083 }//while ends 00084 }//int main ends 00085 00086 00087 00088 /* 00089 mp3.putc(0x7E); 00090 mp3.putc(0xFF); 00091 mp3.putc(0x06); 00092 mp3.putc(0x01);////次曲再生コマンド 00093 mp3.putc(0x00); 00094 mp3.putc(0x00);// 00095 mp3.putc(0x00);// 00096 mp3.putc(0xEF); 00097 */ 00098 /* 00099 mp3.putc(0x7E); 00100 mp3.putc(0xFF); 00101 mp3.putc(0x06); 00102 mp3.putc(0x0E); //ポーズCMD 00103 mp3.putc(0x00); 00104 mp3.putc(0x00); // 00105 mp3.putc(0x00); // 00106 mp3.putc(0xEF); 00107 */
Generated on Fri Jul 15 2022 12:19:12 by
1.7.2