plays a fucking annoying sound for 10 seconds and loops.
Dependencies: mbed
Fork of song_demo_PWM by
main.cpp
- Committer:
- mganseij
- Date:
- 2015-10-29
- Revision:
- 7:29dd200668db
- Parent:
- 5:54dda16baec4
File content as of revision 7:29dd200668db:
#include "mbed.h"
#include "tones.h"
#include "SongPlayer.h"
// I apologize in advance for this fucking mess of a code
// Update: it's slightly less of a mess right now! :D
DigitalIn input(A4);
SongPlayer mySpeaker(A5);
Timer songTimer;
Timer deathTimer;
bool deathbool = false;
void death()
{
deathTimer.reset();
mySpeaker.PlaySong(note_death,duration_death);
}
int main()
{
songTimer.start();
deathTimer.start();
mySpeaker.PlaySong(note,duration);
while(1)
{
if(input == 0)
{
keepplaying = true;
}
else
{
//keepplaying = false; commented out for now
}
if(input == 1 and deathTimer.read() > 4)
{
death();
}
if(songTimer.read() > 15)
{
songTimer.reset();
mySpeaker.PlaySong(note,duration);
}
wait(.1);
}
}
