Power Grid Board Game Timer. Acts like a chess timer for 3-6 people. Uses an ADXL accelerometer to pause the timer and change players. Uses an LCD screen to prompt the players for input, read that input, and change between rounds.
Dependencies: DmTouch_UniGraphic UniGraphic-forLdelaney17FinalProject mbed
Diff: Song.h
- Revision:
- 4:e14c199c2466
diff -r 22c644f16365 -r e14c199c2466 Song.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Song.h Wed Jan 25 10:03:52 2017 +0000 @@ -0,0 +1,39 @@ +#ifndef SONG_H +#define SONG_H +#include<vector> +#include "mbed.h" +extern PwmOut myBuzzer; +extern Timeout note_duration; +extern DigitalOut led; +extern Serial pc; + +class Song{ +protected: + float beat_length; +public: + vector<float> freqs; + vector<float> beats; + //int * freqs; + //int * beats; + int song_length; + int place_in_song; + + Song(vector<float> &freq, vector<float> &beat, int length, int tempo){ //length format left over from int arrays. Had pointer issues. Replaced with vectors. + pc.printf("In song constructor with length %d\r\n", length); + if (tempo == 0) //prevent divide by zero runtime errors + tempo = 120; + beat_length = 60.0/tempo; //beats/minute -> beat duration in seconds + pc.printf("Beat length is %.2fs\r\n", beat_length); + freqs = freq; + beats = beat; + song_length = length; + place_in_song = 0; + return; + } + + void play(); + void set_note(int index); + void set_tempo(int tempo); +}; + +#endif \ No newline at end of file