Arduino Sound Sensor

Arduino Add comments

Arduino Sound Sensor Module for Sensor Shield

Original post on EBay


Example code to read data from the sensor:

int sensorPin = 2;    // 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
}
Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in