0% found this document useful (0 votes)
6 views2 pages

Ir People Counter

The document contains a code snippet for an Arduino program that uses an infrared sensor to detect objects. When an object is detected, it increments a people count and activates a buzzer while printing the count to the serial monitor. The program also resets the detection state when the object is no longer detected.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Ir People Counter

The document contains a code snippet for an Arduino program that uses an infrared sensor to detect objects. When an object is detected, it increments a people count and activates a buzzer while printing the count to the serial monitor. The program also resets the detection state when the object is no longer detected.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

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;

You might also like