int Contrast = 100;
int in = 12; // ir sensor 1
int out = 11;// ir sensor 2
int led = 10;
int count=0;
void setup()
{
pinMode(in, INPUT);
pinMode(out, INPUT);
pinMode(led, OUTPUT);
Serial.println("Visitor Counter");
Serial.print("Person In Room:");
Serial.begin(9600);
}
void loop()
{
if(digitalRead(in))
{
count++;
Serial.println("Person In Room:");
Serial.print(count);
delay(1000);
}
if(digitalRead(out))
{
count--;
Serial.println("Person In Room:");
Serial.print(count);
delay(1000);
}
if(count<=0)
{
digitalWrite(led, LOW);
Serial.println("Nobody In Room");
Serial.println("Light Is Off");
delay(200);
}
else if(count>6)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
}