以前のLibraryでは、スピーカ出力にPWM,DigitalOutを使いましたが、これは、両方ともPWMにしたものです。LPC1114FN28ではDigitalOutにノイズが乗ることがありその対応です。
Dependents: kitchenTimer LPC1114FN28_kitchenTimer_Clock
Fork of Sound by
Diff: Sound.h
- 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) { * } *} *