Library to control Electret Microphone Amplifier - MAX9814 from adafruit. Allows: To sample analogue voltage to transform into rough sound level. Transfer sound level to visual indicator, volume bar such as 4 LEDs on LPC11U24.
Dependents: MAX9814_LED_Sound_Indicator
MAX9814.h
- Committer:
- andcor02
- Date:
- 2014-11-02
- Revision:
- 3:1a773fb0d7e7
- Parent:
- 2:af2a48ef297c
File content as of revision 3:1a773fb0d7e7:
/* MAX9814.h - MAX9814 sensor library Developed by Andrea Corrado */ /* Example 'main.cpp' #include "mbed.h" #include "MAX9814.h" Serial pc (USBTX, USBRX); MAX9814 mic(p20); int main() { while (1) { mic.volume_indicator(); pc.printf("\n\r Level is %f", mic.sound_level()); } } */ #ifndef MBED_MIC_H #define MBED_MIC_H #include "mbed.h" class MAX9814 { public: MAX9814(PinName pin); void led_array(float x); void volume_indicator(); float calibration(); float sound_level(); protected: AnalogIn _pin; BusOut _led1, _led2, _led3, _led4; float _value,_sum,_average; int _count; float _sample; Timer _t,_t1; }; #endif