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.
Revision 0:90420c300e64, committed 2016-07-16
- Comitter:
- kohacraft
- Date:
- Sat Jul 16 05:55:02 2016 +0000
- Commit message:
- ver1.0
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 90420c300e64 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jul 16 05:55:02 2016 +0000 @@ -0,0 +1,59 @@ +/* 踏切のプログラムです */ +#include "mbed.h" + +DigitalOut sp(dp1); //スピーカーのピンを設定します +DigitalOut l1(dp13);//1つ目のLEDのピンを設定します +DigitalOut l2(dp14);//2つ目のLEDのピンを設定します + +int main() { + while(1) { + //片方のLEDだけを点灯 + l1 = 1; + l2 = 0; + + //ミの音をちょっと出す + for( int i=0 ; i<20 ; i++ ) + { + sp = 1; + wait(1.0/1318.51/2); //1318.51Hzがミの音 + sp = 0; + wait(1.0/1318.51/2); + } + + + //ドの音を長く出す + for( int i=0 ; i<200*2 ; i++ ) + { + sp = 0; + wait(1.0/1046.50/2); //1046.50Hzがドの音 + sp = 1; + wait(1.0/1046.50/2); + } + wait (0.1); + + //もう片方のLEDだけを点灯 + l1 = 0; + l2 = 1; + + //ミの音をちょっと出す + for( int i=0 ; i<20*2 ; i++ ) + { + sp = 1; + wait(1.0/1318.51/2); + sp = 0; + wait(1.0/1318.51/2); + } + + + //ドの音を長く出す + for( int i=0 ; i<200*2 ; i++ ) + { + sp = 0; + wait(1.0/1046.50/2); + sp = 1; + wait(1.0/1046.50/2); + } + wait (0.1); + + } +}
diff -r 000000000000 -r 90420c300e64 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jul 16 05:55:02 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file