Program 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.

Dependencies:   MAX9814_Electret_Microphone_LED_Volume_Indicator mbed

Committer:
andcor02
Date:
Sun Nov 02 17:12:22 2014 +0000
Revision:
1:380e6ab41172
Parent:
0:d096ca2ffef0
Intergrated Into h. cpp. files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andcor02 1:380e6ab41172 1 #ifndef MBED_MIC_H
andcor02 1:380e6ab41172 2 #define MBED_MIC_H
andcor02 1:380e6ab41172 3
andcor02 1:380e6ab41172 4 #include "mbed.h"
andcor02 1:380e6ab41172 5
andcor02 1:380e6ab41172 6 class MAX9814 {
andcor02 1:380e6ab41172 7
andcor02 1:380e6ab41172 8 public:
andcor02 1:380e6ab41172 9
andcor02 1:380e6ab41172 10 MAX9814(PinName pin);
andcor02 1:380e6ab41172 11
andcor02 1:380e6ab41172 12 void led_array(float x);
andcor02 1:380e6ab41172 13
andcor02 1:380e6ab41172 14 void volume_indicator();
andcor02 1:380e6ab41172 15
andcor02 1:380e6ab41172 16 float calibration();
andcor02 1:380e6ab41172 17
andcor02 1:380e6ab41172 18 float sound_level();
andcor02 1:380e6ab41172 19
andcor02 1:380e6ab41172 20 protected:
andcor02 1:380e6ab41172 21 AnalogIn _pin;
andcor02 1:380e6ab41172 22 BusOut _led1, _led2, _led3, _led4;
andcor02 1:380e6ab41172 23 float _value,_sum,_average;
andcor02 1:380e6ab41172 24 int _count;
andcor02 1:380e6ab41172 25 float _sample;
andcor02 1:380e6ab41172 26 Timer _t,_t1;
andcor02 1:380e6ab41172 27 };
andcor02 1:380e6ab41172 28
andcor02 1:380e6ab41172 29 #endif