Sound Sensor LED light show question


For a school project, I am using a sound sensor to turn on 7 LEDs to music. I found this project on a website done by someone else, but, their sound sensor has four pins and ours only has three. This is the code that we were given from the person who had previously done this project:

int DO = 2; //Pin for Digital Output - DO
int DA = A0; // Pin for Analog Output - AO
int threshold = 532; //Set minimum threshold for LED lit
int sensorvalue = 0;

void setup() {
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);

void loop() {
sensorvalue = analogRead(DA); //Read the analog value
//Serial.print("Analog: “);
//Serial.print(sensorvalue); //Print the analog value
//Serial.print(” ");
//Serial.print("Digital: ");
//Serial.println(digitalRead(DO)); //Print the digital value

if (sensorvalue >= threshold) { //Compare analog value with threshold
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);

else {
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);

I have tried to change the code to work for my sensor, I’ve done a lot of research and I cannot seem to figure this out. We can get the sound sensor light to turn on (to have power) but I cannot get it to connect to the rest of the code with a correct input pin.

Attached is an image of our set up.


Welcome... can you post any details on the sensor that the other project uses and the one you're using? Datasheet perhaps?

Seems to have both a digital and an analog output, is that right?

Those lines that are commented out: what do they reveal when you put them back?

(Actually looks a bit like an *ultra*sound sensor to me.....)