Microphone, Vu meter App
Microphone, Vu meter App

Microphone, Vu meter App

This application is the same as the previous Analog input application. The only difference is that the microphone module is connected instead of the potentiometer.

The microphone output pin is connected to the A1 analog input of Arduino UNO. The codes are almost the same as the previous codes.

The KY038 microphone module is used for analog signal input.

Codes:

void setup() {
 // Red leds -------------------
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  //blue leds----------------------
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);  //yellow led <------------
  pinMode(6, OUTPUT);  //green led  <-----------
}
 
void loop() {
  int Mic_in = analogRead(A1);// Mic INPUT
int input_level = map(Mic_in, 5, 20, 1, 8); // CONVERT 1--->8
 
for(int i=1;i<=input_level;i++)  {
    digitalWrite(i+5,HIGH); delay(1);digitalWrite(i+5,LOW);
    }
Serial.println(Mic_in);
Serial.println(input_level);
}