![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
DigitalOutによる音だし
main.cpp
- Committer:
- yueee_yt
- Date:
- 2011-12-26
- Revision:
- 0:e31efc30c819
File content as of revision 0:e31efc30c819:
#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); }