PWM出力によって圧電スピーカーで容易に音を鳴らすことができるライブラリです。

Dependents:   kiokuryoku_game escapeFromYou junirobo_sample001 ROBOX_Sample_IRcon ... more

beep_sound.h

Committer:
RBH
Date:
2016-06-04
Revision:
2:259899b723ab
Parent:
1:afc63ce6369b
Child:
3:86238dba1529

File content as of revision 2:259899b723ab:

#ifndef BEEP_SOUND_H
#define BEEP_SOUND_H
#include "mbed.h"

const int frequencyTable[] = {261, 277, 294, 311, 330, 349,
                                370, 392, 415, 440, 466, 494};


class beep_sound
{
    public:
        beep_sound(PinName pwm);
        ~beep_sound();
        void SetFrequency(int octave, int note, bool on_off);
        void onpu(int octave, int note, float time_s);
        void sinwave(float center,int speed,int width);
        void setwave(float frequency,float duty,float wait);
        void beep_right(int nTimes);
        void beep_wrong(int nTimes);
        void beep_1up(int nTimes);
        void beep_konbini(int nTimes);
        void beep_readyGo(int nTimes);
        void beep_encount(int nTimes);
    private:
        PwmOut* m_pwm;
};

#endif