Dom Johnson
/
BeeperMultiple
BeeperMultiple2, with a better Hierarchy...
Embed:
(wiki syntax)
Show/hide line numbers
Beeper.h
00001 #ifndef MBED_BEEPER_H 00002 #define MBED_BEEPER_H 00003 00004 #include "mbed.h" 00005 00006 namespace mbed { 00007 00008 /* Class: Beeper 00009 * A class witch uses pwm to controle a beeper to generate sounds. 00010 */ 00011 class Beeper { 00012 00013 public: 00014 00015 /* Constructor: Beeper 00016 * Creates a new beeper object. 00017 * 00018 * Variables: 00019 * pin - The pin which is connected to the beeper. 00020 */ 00021 Beeper (PinName pin); 00022 00023 /* Function: beep 00024 * Beep with given frequency and duration. 00025 * 00026 * Variables: 00027 * frequency - The frequency to use. 00028 * time - The turation to beep. 00029 */ 00030 void beep (float frequency, float time); 00031 00032 /* Function: note 00033 * Plays a midi note for a given time. 00034 * 00035 * Variables: 00036 * note - The note to play. 00037 * time - The duration to play the note. 00038 */ 00039 void note (int, float time); 00040 void stop(); 00041 00042 private : 00043 PwmOut _pwm; 00044 }; 00045 } 00046 00047 #endif
Generated on Fri Aug 12 2022 04:35:10 by 1.7.2