PWM出力によって圧電スピーカーで容易に音を鳴らすことができるライブラリです。
Dependents: kiokuryoku_game escapeFromYou junirobo_sample001 ROBOX_Sample_IRcon ... more
beep_sound.h@2:259899b723ab, 2016-06-04 (annotated)
- Committer:
- RBH
- Date:
- Sat Jun 04 17:50:58 2016 +0000
- Revision:
- 2:259899b723ab
- Parent:
- 1:afc63ce6369b
- Child:
- 3:86238dba1529
readyGo???
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RBH | 0:c9832831c73f | 1 | #ifndef BEEP_SOUND_H |
RBH | 0:c9832831c73f | 2 | #define BEEP_SOUND_H |
RBH | 0:c9832831c73f | 3 | #include "mbed.h" |
RBH | 0:c9832831c73f | 4 | |
RBH | 0:c9832831c73f | 5 | const int frequencyTable[] = {261, 277, 294, 311, 330, 349, |
RBH | 0:c9832831c73f | 6 | 370, 392, 415, 440, 466, 494}; |
RBH | 0:c9832831c73f | 7 | |
RBH | 2:259899b723ab | 8 | |
RBH | 0:c9832831c73f | 9 | class beep_sound |
RBH | 0:c9832831c73f | 10 | { |
RBH | 0:c9832831c73f | 11 | public: |
RBH | 0:c9832831c73f | 12 | beep_sound(PinName pwm); |
RBH | 0:c9832831c73f | 13 | ~beep_sound(); |
RBH | 0:c9832831c73f | 14 | void SetFrequency(int octave, int note, bool on_off); |
RBH | 0:c9832831c73f | 15 | void onpu(int octave, int note, float time_s); |
RBH | 0:c9832831c73f | 16 | void sinwave(float center,int speed,int width); |
RBH | 0:c9832831c73f | 17 | void setwave(float frequency,float duty,float wait); |
RBH | 0:c9832831c73f | 18 | void beep_right(int nTimes); |
RBH | 0:c9832831c73f | 19 | void beep_wrong(int nTimes); |
RBH | 0:c9832831c73f | 20 | void beep_1up(int nTimes); |
RBH | 0:c9832831c73f | 21 | void beep_konbini(int nTimes); |
RBH | 2:259899b723ab | 22 | void beep_readyGo(int nTimes); |
RBH | 0:c9832831c73f | 23 | void beep_encount(int nTimes); |
RBH | 0:c9832831c73f | 24 | private: |
RBH | 0:c9832831c73f | 25 | PwmOut* m_pwm; |
RBH | 0:c9832831c73f | 26 | }; |
RBH | 0:c9832831c73f | 27 | |
RBH | 0:c9832831c73f | 28 | #endif |