Sakis Kasampalis
/
beep
Send a beep to a speaker
beep.cpp
- Committer:
- faif
- Date:
- 2017-01-22
- Revision:
- 0:c2090cf6119d
File content as of revision 0:c2090cf6119d:
#include "mbed.h" #include "beep.h" static const float delay = 1E-3; // 0.001 int main() { while (true) { if (button) { play_sound(speaker, delay); } } } void play_sound(DigitalOut& speaker, float delay) { speaker = 1; wait(delay); speaker = 0; wait(delay); }