Bert Gereels / Mbed 2 deprecated ProjectOne

Dependencies:   C12832 LM75B mbed EthernetInterface mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers buzzer_music.h Source File

buzzer_music.h

00001 #pragma once 
00002 
00003 #include "mbed.h"
00004 #include <string>
00005 
00006 #define MAX_ARRAY_LENGTH 17
00007 
00008 namespace ProjectOne{
00009         
00010     class BuzzerMusic{
00011         public:
00012             /*
00013             * Constructor for BuzzerMusic class.
00014             *
00015             @param pin that has a connection to the speaker on application board.
00016             @return Nothing.
00017             */
00018             BuzzerMusic(PinName speakerPin=p26);
00019             
00020             /*
00021             * Method that plays music when passed an index.
00022             *
00023             @param String that contains the x and y index (x-y).
00024             @return Nothing.
00025             */
00026             void playMusic(string indexes);
00027         private:
00028             const static int frequencies[MAX_ARRAY_LENGTH];
00029             const static int lengths[MAX_ARRAY_LENGTH];
00030             const static int delays[MAX_ARRAY_LENGTH];
00031             PwmOut speaker;
00032     };
00033 
00034 };