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: EthernetInterface LM75B mbed-rtos mbed
Diff: Buzzer.cpp
- Revision:
- 1:db9b9bec0133
- Child:
- 5:665ba017d54e
diff -r 29eeb74e55c6 -r db9b9bec0133 Buzzer.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Buzzer.cpp Wed Mar 14 14:38:43 2018 +0000
@@ -0,0 +1,24 @@
+#include "buzzer.h"
+
+PwmOut buzz(p26);
+
+float frequency[] = {110,110,110,98,130,110,98,130,110,165,165,165,178,130,104,98,130}; //Frequentietabel
+float length[] = {480,480,480,360,120,480,360,120,960,480,480,480,360,120,480,360,120}; //Duur van het geluid
+float delay[] = {100,100,100,75,100,100,75,100,100,100,100,100,75,100,100,75,100}; //Pauze na een bepaald geluid
+
+Buzzer::Buzzer()
+{
+ //Constructor
+}
+
+//
+void Buzzer::playBuzzer(int start, int eind)
+{
+ for(int i = start - 1; i < eind; i++){
+ buzz.period(1.0 / frequency[i]);
+ buzz=0.5;
+ wait(length[i] / 1000);
+ buzz=0;
+ wait(delay[i] / 1000);
+ }
+}
\ No newline at end of file