Sound Impact Sensor, lost :(

I am working in a group on a project that is using a Parallax sound impact sensor and we aren't exactly the best programmers in the world. On the Parallax website there is a "Basic Stamp(R) 2 Program, not really sure what that means exactly, but anyways we are trying to get it to work with the arduino and don't exactly know how to get it where it can work.

Here is the code from the Parallax website. Any and all help would be appreciated.

' {$STAMP BS2} 
' {$PBASIC 2.5} 
DO 
 IF IN0 = 1 THEN ' When noise detected, display 
 DEBUG HOME, "Sound detected!", CLREOL ' a message 
 PAUSE 1000 
 ELSE ' If no sound is detected, 
 DEBUG HOME,"All is well", CLREOL ' display that all is well. 
 ENDIF 
 PAUSE 10 ' Short delay 
LOOP ' Repeat

A basic stamp is a different type of microcontroller, using different interfaces and a totally different programming language. (A version of BASIC.)

It looks to me like the "sound impact sensor" just pulls a digital input pin high when it detects an impact. That's what the vibration sensor I've created does. You should be able to wire the input into a digital input in on the Arduino and then use the digitalRead command to check for impacts.

Wire the +5V and ground pins of the sensor to power and ground on your Arduino. Attach the sensor output to an available digital input pin on your Arduino (say pin 2, for example.) Then your code might look like this:

#define soundPin 2 //This code uses digital input pin #2. Change this line to the pin number you are using.

void setup()
{
   pinMode(soundPin, INPUT);
}

void loop()
{
  if (digitalRead(soundPin) == TRUE)
  {
    //sound detected, do whatever you need to do.
  }
}

alleniiij678:
I am working in a group on a project that is using a Parallax sound impact sensor and we aren't exactly the best programmers in the world. On the Parallax website there is a "Basic Stamp(R) 2 Program, not really sure what that means exactly, but anyways we are trying to get it to work with the arduino and don't exactly know how to get it where it can work.

Here is the code from the Parallax website. Any and all help would be appreciated.

' {$STAMP BS2} 

' {$PBASIC 2.5}
DO
IF IN0 = 1 THEN ' When noise detected, display
DEBUG HOME, "Sound detected!", CLREOL ' a message
PAUSE 1000
ELSE ' If no sound is detected,
DEBUG HOME,"All is well", CLREOL ' display that all is well.
ENDIF
PAUSE 10 ' Short delay
LOOP ' Repeat