Need help with code

Hi guys. I am currently trying to write a code for a project that improves the accuracy of the six feet dist. rule. I am using a piezoelectric buzzer, PIR sensor, and ultrasonic dist. sensor. I am trying to combine a PIR sensor and an ultrasonic dist sensor. I am trying to set two check points before the piezoelectric buzzer buzzes. I am definitely going to have some errors. As from the fact that I am a newbie, please explain it a little simpler. Thank you.

int buzzer = 13; // LED
int pirPin = 3; // PIR Out pin
int pirStat = 0; // PIR status
int distsens = 12;
int limit = 6;
int total_range = 6;

void setup() {
pinMode(buzzer, OUTPUT);
pinMode(pirPin, INPUT);
pinMode(distsens, INPUT);

}
void loop(){
pirStat = digitalRead(pirPin);
if (pirStat == HIGH) &&
(distsens <= limit && distance >= total_range){ // if motion detected
digitalWrite(buzzer, HIGH);
tone(beeper, 5000, 700);
delay(1000);
noTone(buzzer);
delay(1000);

}
else {
digitalWrite(buzzer, LOW); // turn LED OFF if we have no motion
delay(1000);
}
}

Thanks

if (pirStat == HIGH)
 (distsens <=

Did you forget an AND or an OR operator there?

Please remember to use code tags when posting code.

If you've got errors share them

I got one error (before placing that in my code)

error: expected identifier before '(' token
exit status 1

this was in void loop

Nope, you got me there - setup all looks good to me.

Okay, but thanks for your help!

Hi, the code looks code looks correct except from the fact that limit is equal to total_range, and you also haven't written data to distsens.

May I ask why you are replying to a 2 month old thread? I mean you can, but I am sure the OP would have solved his problem or given it up...Anyway, my best bet is that he won't come back to this thread...