Part One of my Project Course. Implementation of simple I/O and a custom defined protocol over UDP/IP.
Dependencies: C12832 LM75B mbed EthernetInterface mbed-rtos
buzzer_music.h@3:538e17979246, 2018-03-23 (annotated)
- Committer:
- bertgereels
- Date:
- Fri Mar 23 13:42:13 2018 +0000
- Revision:
- 3:538e17979246
- Parent:
- 2:6bfe732ba6bc
Cleared response array before constructing ack.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bertgereels | 0:88d3b9015f7c | 1 | #pragma once |
bertgereels | 0:88d3b9015f7c | 2 | |
bertgereels | 0:88d3b9015f7c | 3 | #include "mbed.h" |
bertgereels | 1:b5c534165dfe | 4 | #include <string> |
bertgereels | 0:88d3b9015f7c | 5 | |
bertgereels | 0:88d3b9015f7c | 6 | #define MAX_ARRAY_LENGTH 17 |
bertgereels | 0:88d3b9015f7c | 7 | |
bertgereels | 0:88d3b9015f7c | 8 | namespace ProjectOne{ |
bertgereels | 0:88d3b9015f7c | 9 | |
bertgereels | 0:88d3b9015f7c | 10 | class BuzzerMusic{ |
bertgereels | 0:88d3b9015f7c | 11 | public: |
bertgereels | 2:6bfe732ba6bc | 12 | /* |
bertgereels | 2:6bfe732ba6bc | 13 | * Constructor for BuzzerMusic class. |
bertgereels | 2:6bfe732ba6bc | 14 | * |
bertgereels | 2:6bfe732ba6bc | 15 | @param pin that has a connection to the speaker on application board. |
bertgereels | 2:6bfe732ba6bc | 16 | @return Nothing. |
bertgereels | 2:6bfe732ba6bc | 17 | */ |
bertgereels | 0:88d3b9015f7c | 18 | BuzzerMusic(PinName speakerPin=p26); |
bertgereels | 2:6bfe732ba6bc | 19 | |
bertgereels | 2:6bfe732ba6bc | 20 | /* |
bertgereels | 2:6bfe732ba6bc | 21 | * Method that plays music when passed an index. |
bertgereels | 2:6bfe732ba6bc | 22 | * |
bertgereels | 2:6bfe732ba6bc | 23 | @param String that contains the x and y index (x-y). |
bertgereels | 2:6bfe732ba6bc | 24 | @return Nothing. |
bertgereels | 2:6bfe732ba6bc | 25 | */ |
bertgereels | 1:b5c534165dfe | 26 | void playMusic(string indexes); |
bertgereels | 0:88d3b9015f7c | 27 | private: |
bertgereels | 0:88d3b9015f7c | 28 | const static int frequencies[MAX_ARRAY_LENGTH]; |
bertgereels | 0:88d3b9015f7c | 29 | const static int lengths[MAX_ARRAY_LENGTH]; |
bertgereels | 0:88d3b9015f7c | 30 | const static int delays[MAX_ARRAY_LENGTH]; |
bertgereels | 0:88d3b9015f7c | 31 | PwmOut speaker; |
bertgereels | 0:88d3b9015f7c | 32 | }; |
bertgereels | 0:88d3b9015f7c | 33 | |
bertgereels | 0:88d3b9015f7c | 34 | }; |