LarryD:
Attach the actual code you are debugging to your next post.
Use the [ code] # button you see at the top of the Text box.
#define trigPin 7
#define echoPin 8
#define buzzerPin 10
void setup()
{
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
}
void loop()
{
int duration, distance;
digitalWrite(trigPin,HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=(duration/2)/29.1;
Serial.print(distance);
Serial.println("cm");
delay(500);
if(distance > 100)
{
digitalWrite(10,LOW);
}
else
{
digitalWrite(10,HIGH);
}
}