void setup() {
pinMode(irSensorPin, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int irValue = digitalRead(irSensorPin);
if (irValue == LOW && !objectDetected) {
objectDetected = true;
peopleCount++;
// Beep
digitalWrite(buzzerPin, HIGH);
delay(200);
digitalWrite(buzzerPin, LOW);
// Print just the digit
Serial.println(peopleCount);
}
if (irValue == HIGH && objectDetected) {
objectDetected = false;