Sound Reactive LED Help

Hi!

So, I'm trying to have my Arduino + sound sensor manipulate LEDs and the code I'm working with doesn't quite do what I need and I'm a bit out of my element here.

The goal is to have the lights glow as someone speaks into the sensor.

Right now, when the sound sensor receives sound it sends either ON or OFF making the LED's blink violently and I'm trying to have the lights dim more gradually.

Any suggestions?

#define LEDstrip 9


void setup()
{
  pinMode(7,INPUT); //SIG of the Parallax Sound Impact Sensor connected to Digital Pin 7
  pinMode(LEDstrip, OUTPUT);

}

//this function will make the LED dim once the Parallax Sound Impact Sensor sends a 1 signal, and then return to it’s original brightness.
void loop()
{
  boolean soundstate = digitalRead(7);
  if (soundstate == 1) {
         analogWrite(LEDstrip, 255);
         delay(10);
  }
  else{
  
    analogWrite(LEDstrip,0);
  }
}

So, I'm trying to have my Arduino + sound sensor manipulate LEDs

A link to the sound sensor would be useful.

Connecting the sensor to a digital pin will tell you only "there is sound" or "it's sure quiet in here".

Any suggestions?

Realistic expectations? Without knowing what sensor you actually have, that's the only thing I can suggest.

No prob; this is my sensor: http://www.ebay.com/itm/LM393-Microphone-Amplifier-Sound-Sensor-MIC-Voice-Module-for-Arduino-3-3V-3-5V-/142087708561

It is connected to a digital pin currently and I guess I’m a bit at a loss on where to go from here.

Here’s my current setup:

this is my sensor

Ebay links are useless.

You might try connecting the device to an analog pin, and see what values you get as you speak softly, normally, and SCREAM at it.

PaulS:
Ebay links are useless.
...

How are Ebay links useless? You implied that they need to provide what sensor they have and the link leads to the details/description of the exact sensor.

With that being said..

natewhatever:
Right now, when the sound sensor receives sound it sends either ON or OFF making the LED's blink violently and I'm trying to have the lights dim more gradually.

Any suggestions?

It looks like the sensor you have can only detect sound or no sound. It can't differentiate between "quiet" sound or "loud" sound. There might be a round about way to do it within your code, but it might get a little complicated. For example, if there is a continuous sound, set the LEDs to start at a "dim" color and then iterate through colors that are increasingly brighter. If there is no sound after a set amount of time, then have them go off. Not saying this is guaranteed to work, but it might be worth a try.

I know this post is pretty old, but I just thought I'd offer some help (sorry it wasn't much).