Examples - Electronic Bricks - Electronic Brick Sound Sensor

Analog-In, Using the Sound Sensor Electronic Brick.

This program gives you a basic understanding how to use the Sound Sensor Electronic Brick.

The Arduino can Read the Analog signal via the AD by the analog pin, and put out the analog signal by PWM pins. In Arduino there are 6 analog input pins from A0-A1, and there are 6 analog output pins: D3 D5 D6 D9 D10 D11.

Hardware Setup:

/*
Example: How to use the 'Analog Sound Sensor Electronic Brick'
Usage: Connect the Sound Sensor Brick to analog pin 5 on the Seeduino Shield
*/
// Define the analog input pin for the sound sensor
int sensorInputPin = 5;

void setup()
{
        Serial.begin(9600);                 // Invoke Serial Interface for debugging purposes
}

void loop()
{
        // Read the sensor
        int sound = analogRead(sensorInputPin);
        // Output to console or computer
        Serial.println(sound);
        // delay the print line output by 0.5 seconds
        delay(500);
}