This library sets up and LED volume indication function and reading values from the Electret Microphone - MAX4466 Amplifier

Dependents:   MAX4466_Hello_World

Files at this revision

API Documentation at this revision

Comitter:
mgolino
Date:
Fri Oct 23 19:37:07 2015 +0000
Parent:
0:712373b300a2
Commit message:
Added more comments

Changed in this revision

MAX4466.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 712373b300a2 -r 76c72cf9ae2b MAX4466.cpp
--- a/MAX4466.cpp	Fri Oct 23 18:37:33 2015 +0000
+++ b/MAX4466.cpp	Fri Oct 23 19:37:07 2015 +0000
@@ -40,8 +40,10 @@
 }
 
 //LED ARRAY FUNCTION:
-//Setup array of 4 LEDs based on the current value read by the microphone
-//And the average value found during calibration
+//Setup array of 4 LEDs 
+//The input to this function is the average from the calibration function
+//The variable _value which indicates the current value from the microphone is a global variable updated in the sound_level function
+//As different threshholds of volume are met more LEDs will light up
 void MAX4466::led_array(float x ) {
 
     if (_value<x+0.05) {
@@ -77,7 +79,8 @@
 }
 
 //SOUND LEVEL FUNCTIOM:
-//Read in current sound level
+//Read in current sound level from the microphone
+//Update the global variable _value which will in turn be read by the LED array function
 float MAX4466::sound_level() {
 
     _t.start();
@@ -106,6 +109,8 @@
 
 //VOLUME INDICATOR FUNCTION:
 //To be called in main function
+//Updates the led array
+//outputs current numerical value
 void MAX4466::volume_indicator() {
         led_array(_average);
         sound_level();