suu pen / Mbed 2 deprecated SoundLibraryExample_Tone

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
suupen
Date:
Sun Nov 20 08:30:42 2011 +0000
Commit message:
V1.0 2011/11/20

Changed in this revision

Sound.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0b399d7dc98a Sound.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sound.lib	Sun Nov 20 08:30:42 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/suupen/code/Sound/#66e192fc663e
diff -r 000000000000 -r 0b399d7dc98a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 20 08:30:42 2011 +0000
@@ -0,0 +1,34 @@
+//=============================================
+// Sound Library Example Program
+//  This sample program will play a single note
+//
+// <schematic>
+//
+//                                               /
+//   mbed                 --------------      --/
+//   p21(pwmOut)     -----| R:200[ohm] |-----|  |  speaker
+//                        --------------     |  |
+//                                           |  |
+//   p10(DigitalOut) ------------------------|  |
+//                                            --\
+//                                               \
+//==============================================
+#include "mbed.h"
+#include "Sound.h"
+
+Sound sound(p21, p10);
+
+int main() {
+    while(1) {
+        // tone1 (G5 Pronunciation time = 200ms, envelope time = 100ms)
+        Sound::sound_t oto = {1,0x95,200,100};
+        sound.sound_sound(oto);                 // To start the sound output
+        while(sound.sound_sound() == true){}    // Wait until the end of the sound output
+
+        // tone2 (A5 Pronunciation time = 2000ms, envelope time = 1000ms)
+        oto.hanon = 1; oto.onkai = 0xA5; oto.time = 2000; oto.envelope = 1000;
+        sound.sound_sound(oto);
+        while(sound.sound_sound() == true){}
+       
+    }
+}
diff -r 000000000000 -r 0b399d7dc98a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Nov 20 08:30:42 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912