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 1:6f3f23dd913b, committed 2011-12-29
- Comitter:
- yueee_yt
- Date:
- Thu Dec 29 06:13:11 2011 +0000
- Parent:
- 0:6d34e90916d4
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 26 13:05:05 2011 +0000 +++ b/main.cpp Thu Dec 29 06:13:11 2011 +0000 @@ -16,7 +16,7 @@ void sound_out(void) { static float j=0; j=j+m1; - if(j>180)j=j-180; + if (j>180)j=j-180; sp1.write(ms[(int)j]); } @@ -24,13 +24,14 @@ float mm[]={mC,mD,mE,mF,mG,mA,mB,mC*2}; int i; //setting sincurv - for (i=0;i<180;i++) { + for (i=0; i<180; i++) { ms[i]=sin(2*3.1415*(float)i/180.0)/2.0+0.5; } - for (i=0;i<sizeof(mm);i++) { - m1=mm[i]*180/10000; - timer.attach_us(&sound_out,100); //10kHz + timer.attach_us(&sound_out,10); //10kHz + + for (i=0; i<sizeof(mm); i++) { + m1=mm[i]*180/100000; wait(0.5f); } sp1.write(0.0f);