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.
Dependencies: mbed
Fork of Arch_Play_Music by
main.cpp
00001 #include "mbed.h" 00002 #include "pitches.h" 00003 00004 DigitalOut myled(LED1); 00005 00006 PwmOut buzzer(P1_14); // Buzzer connected to UART Grove connector (PWM output) 00007 00008 int frequency[] = {NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3, 1, NOTE_B3, NOTE_C4}; 00009 int beat[] = {4, 8, 8, 4,4,4,4,4 }; 00010 00011 int main() { 00012 for (int i = 0; i < (sizeof(frequency) / sizeof(int)); i++) { 00013 buzzer.period(1.0 / frequency[i]); 00014 buzzer.write(0.5); 00015 wait(1.0 / beat[i]); 00016 buzzer.write(0); 00017 wait(0.05); 00018 } 00019 00020 while(1) { 00021 myled = !myled; 00022 wait(1); 00023 } 00024 }
Generated on Wed Jul 13 2022 17:57:55 by
1.7.2
