Grove soundsensor lib

soundsensor.h

Committer:
math991e
Date:
2019-01-17
Revision:
0:18d442efc99a
Child:
1:29daa2bdd0c6

File content as of revision 0:18d442efc99a:

/**
*#include "mbed.h"
*#include "soundsensor.h"
*soundsensor sound(A0);
*bool toDb = true;
*
*int main()
*{
*    while (true) {
*        printf("Loudness: %f\r\n", sound.listen(toDb));
*        wait(0.5);
*    }
*}
**/

#ifndef SOUNDSENSOR
#define SOUNDSENSOR

class soundsensor{
    private:
        PinName _pin;
    public:
        soundsensor(PinName);
        void setpin(PinName pin);
        PinName getPin();
        float convertToDb(float);
        float revertFromDb(float);
        float listen(float input, bool toDb);
}

#endif