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
Buzzer.cpp
- Committer:
- RobinMechele
- Date:
- 2018-03-18
- Revision:
- 5:665ba017d54e
- Parent:
- 1:db9b9bec0133
File content as of revision 5:665ba017d54e:
#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); } }