Revenge of the Mouse

Dependencies:   4DGL-uLCD-SE EthernetInterface Game_Synchronizer LCD_fonts MMA8452 SDFileSystem mbed-rtos mbed wave_player

Fork of 2035_Tanks_Shell by ECE2035 Spring 2015 TA

Committer:
jford38
Date:
Wed Oct 28 04:30:22 2015 +0000
Revision:
17:7bc7127782e4
Works with updates to game synchronizer. The synchronizer now contains buttons/accelerometers.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jford38 17:7bc7127782e4 1 #include "mbed.h"
jford38 17:7bc7127782e4 2 // new class to play a note on Speaker based on PwmOut class
jford38 17:7bc7127782e4 3 class Speaker
jford38 17:7bc7127782e4 4 {
jford38 17:7bc7127782e4 5 public:
jford38 17:7bc7127782e4 6 Speaker(PinName pin) : _pin(pin) {
jford38 17:7bc7127782e4 7 // _pin(pin) means pass pin to the Speaker Constructor
jford38 17:7bc7127782e4 8 }
jford38 17:7bc7127782e4 9 // class method to play a note based on PwmOut class
jford38 17:7bc7127782e4 10 void PlayNote(float frequency, float duration, float volume) {
jford38 17:7bc7127782e4 11 _pin.period(1.0/frequency);
jford38 17:7bc7127782e4 12 _pin = volume/2.0;
jford38 17:7bc7127782e4 13 wait(duration);
jford38 17:7bc7127782e4 14 _pin = 0.0;
jford38 17:7bc7127782e4 15 }
jford38 17:7bc7127782e4 16
jford38 17:7bc7127782e4 17 private:
jford38 17:7bc7127782e4 18 PwmOut _pin;
jford38 17:7bc7127782e4 19 };