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.
Fork of Smoke_Water by
main.cpp
00001 #include "mbed.h" 00002 00003 PwmOut buzzer(p21); 00004 BusOut led(LED1,LED2,LED3,LED4); 00005 float frequency[] = {262,0,262,0,262,0,349,0,523,0,466,0,440,0,392,0,698,0,523,0,466,0,440,0,392,0,698,0,523,0,466,0,440,0,466,0,392,0,/**/}; 00006 float beat[] = {.3,0,.3,0,.3,0,2,0,2,0,.3,0,.3,0,.3,0,2,0,1,0,.3,0,.3,0,.3,0,2,0,1,0,.3,0,.3,0,.3,0,2,0/**/}; 00007 float frequency2[] = {262,0,262,0,294,0,294,0,466,0,440,0,392,0,349,0,349,0,392,0,440,0,392,0,294,0,330,0,523,0,523,0,698,0,622,0,554,0,523,0,466,0,415,0,392,0,349,0,523,0}; 00008 float beat2[] = {.75,0,.25,0,1.5,0,.5,0,.5,0,.5,0,.5,0,.5,0,.3,0,.3,0,.3,0,1,0,.5,0,1,0,.75,0,.25,0,1,0,.5,0,1,0,.5,0,1,0,.5,0,1,0,.5,0,4,0}; 00009 00010 int main() { 00011 while(1) 00012 { 00013 00014 for(int i=0; i<= 37;i++) 00015 { 00016 buzzer.period(2/(frequency[i])); 00017 buzzer = 0.5; 00018 00019 wait(0.4*beat[i]); 00020 if(beat[i]==0) 00021 {wait(.05);} 00022 00023 } 00024 00025 for(int i=0; i<= 49;i++) 00026 { 00027 buzzer.period(2/(frequency2[i])); 00028 buzzer = 0.5; 00029 00030 wait(0.4*beat2[i]); 00031 if(beat2[i]==0) 00032 {wait(.05);} 00033 00034 } 00035 00036 } 00037 }
Generated on Sun Jul 31 2022 06:26:11 by
1.7.2
