2018年度の機体、S-240に搭載する予定だった高度警報のプログラムである。
Revision 0:5ce6ec9465a4, committed 2019-12-30
- Comitter:
- Joeatsumi
- Date:
- Mon Dec 30 08:35:51 2019 +0000
- Commit message:
- This program was for altitude alarm of Human Powered Aircraft.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 30 08:35:51 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/aa5281ff4a02 \ No newline at end of file