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:
- 1:2967eac08981
- Parent:
- 0:c3bc6981ad28
- Child:
- 4:d61f6d186db0
--- a/sound.cpp Wed Jan 31 10:58:19 2018 +0000
+++ b/sound.cpp Wed Feb 21 09:13:28 2018 +0000
@@ -1,12 +1,13 @@
#include "mbed.h"
+#include "commands.h"
PwmOut spkr(p26);
-void SoundInitialize(void) {
+void _Initialize(void) {
spkr=0.0;
}
-void SoundProcess(void) {
+void _Process(void) {
for (float i = 2000.0; i < 10000.0; i += 100) {
spkr.period(1.0 / i);
spkr = 0.5;
@@ -14,6 +15,8 @@
}
}
-void SoundFinalize(void) {
- SoundInitialize();
-}
\ No newline at end of file
+void _Finalize(void) {
+ _Initialize();
+}
+
+COMMAND_DEFINE Command_sound = {"sound", 0x01, _Initialize, _Finalize, _Process};
\ No newline at end of file