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@0:49d2ee7cb020, 2014-11-02 (annotated)
- Committer:
- andcor02
- Date:
- Sun Nov 02 17:32:03 2014 +0000
- Revision:
- 0:49d2ee7cb020
- Child:
- 1:cf181e6a2ead
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.; ; ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andcor02 | 0:49d2ee7cb020 | 1 | #ifndef MBED_MIC_H |
andcor02 | 0:49d2ee7cb020 | 2 | #define MBED_MIC_H |
andcor02 | 0:49d2ee7cb020 | 3 | |
andcor02 | 0:49d2ee7cb020 | 4 | #include "mbed.h" |
andcor02 | 0:49d2ee7cb020 | 5 | |
andcor02 | 0:49d2ee7cb020 | 6 | class MAX9814 { |
andcor02 | 0:49d2ee7cb020 | 7 | |
andcor02 | 0:49d2ee7cb020 | 8 | public: |
andcor02 | 0:49d2ee7cb020 | 9 | |
andcor02 | 0:49d2ee7cb020 | 10 | MAX9814(PinName pin); |
andcor02 | 0:49d2ee7cb020 | 11 | |
andcor02 | 0:49d2ee7cb020 | 12 | void led_array(float x); |
andcor02 | 0:49d2ee7cb020 | 13 | |
andcor02 | 0:49d2ee7cb020 | 14 | void volume_indicator(); |
andcor02 | 0:49d2ee7cb020 | 15 | |
andcor02 | 0:49d2ee7cb020 | 16 | float calibration(); |
andcor02 | 0:49d2ee7cb020 | 17 | |
andcor02 | 0:49d2ee7cb020 | 18 | float sound_level(); |
andcor02 | 0:49d2ee7cb020 | 19 | |
andcor02 | 0:49d2ee7cb020 | 20 | protected: |
andcor02 | 0:49d2ee7cb020 | 21 | AnalogIn _pin; |
andcor02 | 0:49d2ee7cb020 | 22 | BusOut _led1, _led2, _led3, _led4; |
andcor02 | 0:49d2ee7cb020 | 23 | float _value,_sum,_average; |
andcor02 | 0:49d2ee7cb020 | 24 | int _count; |
andcor02 | 0:49d2ee7cb020 | 25 | float _sample; |
andcor02 | 0:49d2ee7cb020 | 26 | Timer _t,_t1; |
andcor02 | 0:49d2ee7cb020 | 27 | }; |
andcor02 | 0:49d2ee7cb020 | 28 | |
andcor02 | 0:49d2ee7cb020 | 29 | #endif |