

void setup() {
//Serial.begin(9600); // Start Serial for Debugging @9600 Baud
pinMode(LED_BUILTIN, OUTPUT); // D13 as Drive Output
}
void loop() {
int analog_val;
static bool led_state = false;
analog_val = analogRead(A2); // A2 as Signal Input
if (analog_val > 480) { // Threshold Value – Tweak Yourself!
if (led_state) {
led_state = false;
digitalWrite(LED_BUILTIN, LOW); // Drive Output = OFF
//Serial.println(analog_val);
} else {
led_state = true;
digitalWrite(LED_BUILTIN, HIGH); // Drive Output = ON
//Serial.println(analog_val);
}
delay(1000); // Halt for a while
}
}
max9814_microphone_module_en.pdf