このライブラリでは、単音とメロディの出力が可能です。 In this library, you can output a single tone and melody. mbedのpwmOutとDigitalOutを使ってスピーカや圧電ブザーを直接駆動します。 directly drive speaker or buzzer and DigitalOut pwmOut using the mbed. メロディデータは、mbedのローカルにtxtファイルとして保存するか、プログラム中に配列データとして保存してください。 Melody data is either stored in a txt file on the local mbed, save it as a data array in the program.

Dependents:   kitchenTimer_Clock SoundLibraryExample_Melody_ProgramData M3PI_SuiviLigne

Revision:
5:9d861f258467
Parent:
4:dc8c3e896c80
Child:
6:fb02f6d9bbaf
--- a/Sound.h	Wed Nov 16 12:40:22 2011 +0000
+++ b/Sound.h	Wed Nov 16 13:57:19 2011 +0000
@@ -27,7 +27,7 @@
 *                                  
 *                  --------      _/
 *  mbed(p21) -----|R:200ohm|----| |  speaker
-*       pwmOut     --------
+*       pwmOut     --------     | | 
 *                               | |
 *  mbed(p10) -------------------|_|
 *       digitalOut                \
@@ -62,31 +62,28 @@
 * //---------------------
 * // enso data no settei
 * //---------------------
-* //    sound.sound_enso("/local/enso.txt");     // mbed local file data "enso.txt" load (sita ni data no rei wo oite oku)
-*    sound.sound_enso((Sound::sound_t*)DEMEKIN);
+* // sound.sound_enso("/local/enso.txt");     // mbed local file data "enso.txt" load (sita ni data no rei wo oite oku)
+*    sound.sound_enso((Sound::sound_t*)WESTMINSTER);
 *    
-*    while(1) {
-*
-*        //---------------------------------------------------
-*        // tanon syuturyoku no ato ni westminster chime enso
-*        //---------------------------------------------------
-*        if(sound.sound_enso() == false){
-*        //sound2.sound_enso((Sound::sound_t*)RAMEN);
-*
+*    //---------------------------------------------------
+*    // output tone
+*    //---------------------------------------------------
+*    // tone1 
+*    Sound::sound_t oto = {1,0x95,200,100};
+*    sound.sound_sound(oto);
+*    while(sound.sound_sound() == true){}
+*            
+*    // tone2
+*    oto.hanon = 1; oto.onkai = 0xA5; oto.time = 2000; oto.envelope = 1000;
+*    sound.sound_sound(oto);
+*    while(sound.sound_sound() == true){}
 *
-*            // tanon1 
-*            Sound::sound_t oto = {1,0x95,200,100};
-*            sound.sound_sound(oto);
-*            while(sound.sound_sound() == true){}
-*            
-*            // tanon2
-*            oto.hanon = 1; oto.onkai = 0xA5; oto.time = 2000; oto.envelope = 1000;
-*            sound.sound_sound(oto);
-*            while(sound.sound_sound() == true){}
+*    //---------------
+*    // output merody
+*    //--------------
+*    sound.sound_enso(true);
 *
-*            // sai enso
-*            sound.sound_enso(true);
-*        }
+*    while(1) {
 *    }
 *}
 *