Grove soundsensor lib
Diff: soundsensor.h
- Revision:
- 0:18d442efc99a
- Child:
- 1:29daa2bdd0c6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/soundsensor.h Thu Jan 17 07:42:19 2019 +0000 @@ -0,0 +1,31 @@ +/** +*#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 \ No newline at end of file