main部分を作成しました(あくまで案です)
Dependencies: mbed
Revision 0:882f69fd7a02, committed 2016-01-15
- Comitter:
- osakah
- Date:
- Fri Jan 15 06:15:27 2016 +0000
- Commit message:
- main????????
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 |
diff -r 000000000000 -r 882f69fd7a02 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jan 15 06:15:27 2016 +0000 @@ -0,0 +1,71 @@ +#include "mbed.h" +//出力先をLED1にする +DigitalOut myled(LED1); +//長点短点の長さはこうらしい +int dot = 0.3; +int dash = dot*3; +//プロトタイプ宣言 +int Signal(int TX); +//TX番号、状態 +int TX = 5; +int TXstate = 0; + +int main() { + while(1){ + //TXの状態TXstateで分岐 0:待機、1:アクティブ、2:メンテ etc... + //0,1の切り替えは時間経過で、0or1 ⇔ 2 の切り替えはボタンで?? + switch (TXstate){ + case 0 : + //待機 + break; + case 1 : + //アクティブ + Signal(TX); + break; + case 2 : + //メンテナンス + break; + default : + break; + } + + } +} + +//信号送信(現在はLチカ) +int Signal(TX) { + //M + myled = 1; + wait(dash); + myled = 0; + wait(dot); + myled = 1; + wait(dash); + myled = 0; + wait(dot*3); + + //O + myled = 1; + wait(dash); + myled = 0; + wait(dot); + myled = 1; + wait(dash); + myled = 0; + wait(dot); + myled = 1; + wait(dash); + myled = 0; + wait(dot*3); + + //number + for(i=0;i<TX;i++){ + myled = 1; + wait(dot); + myled = 0; + wait(dot); + } + for(i=0;i<6-TX;i++) wait(dot*2); + //Signal: (dot*4+dash*2)+(dot*5+dash*3)+dot*12 = dot*21+dash*5 = 10.8秒(メモ) + return0; +}
diff -r 000000000000 -r 882f69fd7a02 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jan 15 06:15:27 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96 \ No newline at end of file