Arduino Sound Sensor Module - LM393


int sensorPin = 4; // select the input pin for the sensor
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor

void setup()
  pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
  Serial.begin(9600); // initialize serial communication with computer

void loop()
  val = analogRead(sensorPin); // read the value from the sensor;
  Serial.println(val); // send it to the computer (as ASCII digits); 
  digitalWrite(ledPin, HIGH); // turn the ledPin on;
  delay(val); // stop the program for some time; 
  digitalWrite(ledPin, LOW); // turn the ledPin off; 
  delay(val); // stop the program for some time