Yasushi TAUCHI
/
Sound_DigitalOut
DigitalOutによる音だし
Revision 0:e31efc30c819, committed 2011-12-26
- Comitter:
- yueee_yt
- Date:
- Mon Dec 26 12:34:00 2011 +0000
- Commit message:
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 e31efc30c819 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 26 12:34:00 2011 +0000 @@ -0,0 +1,31 @@ +#define mC 261.626 +#define mD 293.665 +#define mE 329.628 +#define mF 349.228 +#define mG 391.995 +#define mA 440.000 +#define mB 493.883 + +#include "mbed.h" + +DigitalOut sp1(p5); +Ticker timer; + +int oto=0; + +void tick(void) +{ + sp1.write(oto); + oto=!oto; +} + +int main() { + float mm[]={mC,mD,mE,mF,mG,mA,mB,mC*2}; + int i; + for (i=0;i<sizeof(mm);i++) { + timer.attach(&tick,1.0/mm[i]/2.0); + wait(0.5f); + } + timer.detach(); + while(1); +}
diff -r 000000000000 -r e31efc30c819 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 26 12:34:00 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/078e4b97a13e