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: C12832 MMA7660 mbed
Diff: sound.cpp
- Revision:
- 0:c3bc6981ad28
- Child:
- 1:2967eac08981
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sound.cpp Wed Jan 31 10:58:19 2018 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+
+PwmOut spkr(p26);
+
+void SoundInitialize(void) {
+ spkr=0.0;
+}
+
+void SoundProcess(void) {
+ for (float i = 2000.0; i < 10000.0; i += 100) {
+ spkr.period(1.0 / i);
+ spkr = 0.5;
+ wait(0.1);
+ }
+}
+
+void SoundFinalize(void) {
+ SoundInitialize();
+}
\ No newline at end of file