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 #include "Speaker.h" 00003 00004 // Speaker test program - euro police style siren now using new Speaker class method 00005 // for documentation see http://mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/ 00006 // can also be used to play a song, if you have all of the notes and durations 00007 // for musical note frequencies see http://en.wikipedia.org/wiki/Piano_key_frequencies 00008 00009 int main() 00010 { 00011 // setup instance of new Speaker class, mySpeaker using pin 21 00012 // the pin must be a PWM output pin 00013 Speaker mySpeaker(p21); 00014 // loops forever playing two notes on speaker 00015 while(1) { 00016 mySpeaker.PlayNote(969.0,0.5,0.5); 00017 mySpeaker.PlayNote(800.0,0.5,0.5); 00018 } 00019 } 00020
Generated on Thu Jul 14 2022 03:45:03 by
1.7.2