Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
play_buzzer.h@6:9ab8c4b24da7, 2019-01-11 (annotated)
- Committer:
- math991e
- Date:
- Fri Jan 11 07:57:11 2019 +0000
- Revision:
- 6:9ab8c4b24da7
- Parent:
- 5:d879dead6768
- Child:
- 7:9837cd1a23c6
Update documentation;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| math991e | 5:d879dead6768 | 1 | /** |
| math991e | 6:9ab8c4b24da7 | 2 | * @file play_buzzer.h |
| math991e | 6:9ab8c4b24da7 | 3 | * @brief this cpp file is where all the logic is handled. |
| math991e | 5:d879dead6768 | 4 | * |
| math991e | 5:d879dead6768 | 5 | * @author Nikolaj M. & Mathias R. |
| math991e | 5:d879dead6768 | 6 | * |
| math991e | 5:d879dead6768 | 7 | * @date 10/1/2019 |
| math991e | 5:d879dead6768 | 8 | */ |
| math991e | 5:d879dead6768 | 9 | |
| math991e | 5:d879dead6768 | 10 | //PROGRAM: play_buzzer |
| math991e | 1:50204a498764 | 11 | #ifndef PLAY_BUZZER_H |
| math991e | 5:d879dead6768 | 12 | #define PLAY_BUZZER_H |
| math991e | 5:d879dead6768 | 13 | |
| math991e | 5:d879dead6768 | 14 | #include m_bed |
| math991e | 0:e44696c93c6b | 15 | |
| math991e | 0:e44696c93c6b | 16 | |
| math991e | 0:e44696c93c6b | 17 | namespace mbed { |
| math991e | 5:d879dead6768 | 18 | ///play_buzzer CLASS |
| math991e | 0:e44696c93c6b | 19 | class play_buzzer { |
| math991e | 0:e44696c93c6b | 20 | |
| math991e | 5:d879dead6768 | 21 | ///INITIALIZE VARIABLES USED IN CLASS |
| math991e | 0:e44696c93c6b | 22 | private : |
| math991e | 0:e44696c93c6b | 23 | PinName _pin; |
| math991e | 0:e44696c93c6b | 24 | PwmOut _pwm; |
| math991e | 0:e44696c93c6b | 25 | Timeout toff; |
| math991e | 5:d879dead6768 | 26 | ///FUNCTIONS AND CONSTRUCTOR |
| math991e | 0:e44696c93c6b | 27 | public: |
| math991e | 5:d879dead6768 | 28 | void play_buzzer(PinName); |
| math991e | 1:50204a498764 | 29 | void beep (int notes, int tones); |
| math991e | 0:e44696c93c6b | 30 | void nobeep(); |
| math991e | 1:50204a498764 | 31 | int play(int song); |
| math991e | 0:e44696c93c6b | 32 | void setPin(PinName pin); |
| math991e | 0:e44696c93c6b | 33 | PinName getPin(); |
| math991e | 0:e44696c93c6b | 34 | }; |
| math991e | 0:e44696c93c6b | 35 | }; |
| math991e | 0:e44696c93c6b | 36 | #endif |
| math991e | 0:e44696c93c6b | 37 | |
| math991e | 0:e44696c93c6b | 38 |