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@1:50204a498764, 2019-01-10 (annotated)
- Committer:
- math991e
- Date:
- Thu Jan 10 08:26:13 2019 +0000
- Revision:
- 1:50204a498764
- Parent:
- 0:e44696c93c6b
- Child:
- 5:d879dead6768
Update code and comments
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| math991e | 1:50204a498764 | 1 | #ifndef PLAY_BUZZER_H |
| math991e | 0:e44696c93c6b | 2 | #define MBED_BEEP_H |
| math991e | 0:e44696c93c6b | 3 | |
| math991e | 0:e44696c93c6b | 4 | #include "mbed.h" |
| math991e | 0:e44696c93c6b | 5 | |
| math991e | 0:e44696c93c6b | 6 | namespace mbed { |
| math991e | 1:50204a498764 | 7 | //NAME OF CLASS |
| math991e | 0:e44696c93c6b | 8 | class play_buzzer { |
| math991e | 0:e44696c93c6b | 9 | |
| math991e | 1:50204a498764 | 10 | //INITIALIZE VARIABLES USED IN CLASS |
| math991e | 0:e44696c93c6b | 11 | private : |
| math991e | 0:e44696c93c6b | 12 | PinName _pin; |
| math991e | 0:e44696c93c6b | 13 | PwmOut _pwm; |
| math991e | 0:e44696c93c6b | 14 | Timeout toff; |
| math991e | 1:50204a498764 | 15 | //FUNCTIONS AND CONSTRUCTOR |
| math991e | 0:e44696c93c6b | 16 | public: |
| math991e | 0:e44696c93c6b | 17 | play_buzzer(PinName); |
| math991e | 1:50204a498764 | 18 | void beep (int notes, int tones); |
| math991e | 0:e44696c93c6b | 19 | void nobeep(); |
| math991e | 1:50204a498764 | 20 | int play(int song); |
| math991e | 0:e44696c93c6b | 21 | void setPin(PinName pin); |
| math991e | 0:e44696c93c6b | 22 | PinName getPin(); |
| math991e | 0:e44696c93c6b | 23 | }; |
| math991e | 0:e44696c93c6b | 24 | }; |
| math991e | 0:e44696c93c6b | 25 | #endif |
| math991e | 0:e44696c93c6b | 26 | |
| math991e | 0:e44696c93c6b | 27 |