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.
main.cpp
00001 #include "mbed.h" 00002 PwmOut buzzer(p25); 00003 00004 //frequency array 00005 float frequency[]= {659,554,659,554,440,494,554,587,494,659,554,440}; 00006 //beat array 00007 float beat[]= {1,1,1,1,1,0.5,0.5,1,1,1,1,2}; 00008 00009 00010 00011 int main() 00012 { 00013 while (1) { 00014 for (int i=0; i<=11; i++) { 00015 buzzer.period(1/(frequency[i])); // set PWM period 00016 buzzer=0.5; // set duty cycle 00017 wait(beat[i]); // hold for beat period 00018 } 00019 } 00020 }
Generated on Tue Jul 26 2022 01:12:23 by
1.7.2