IR Visitor counter (Arduino)

Bidirectional visitor counter with arduino nano and lcd display:
---------------------------------------------------------------------------------------
This device can be bidirectional (one corridor) or entry - exit (two corridor) also!
Visitor lighthouse LED can be optional. It only helps for visitors attention! Security man can see when device works and visitor lighthouse LED goes off on a moment. The number of visitors is maximum 32767 person!
---------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------
Code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

int visitor = 0;
int situation = 0;
int counter = 0;
int counter2 = 0;
int counter3 = 0;
int beginning = 0;

void setup() {
  pinMode(13, OUTPUT);
  //visitor's lighthouse
  pinMode(11, INPUT);
  digitalWrite(11, HIGH);
  pinMode(12, INPUT);
  digitalWrite(12, HIGH);
//sensors
  pinMode(10, OUTPUT);
  digitalWrite(10, 1);
// IR radiate You can use two from it also.
  lcd.begin(16, 2);
  lcd.setCursor(0,1);
  lcd.clear();
}

void loop() {

if (digitalRead(11) == HIGH && digitalRead(12) == HIGH){
situation = 1;
}

if (digitalRead(11) == LOW && digitalRead(12) == HIGH){
situation = 2;
}


if (digitalRead(11) == HIGH && digitalRead(12) == LOW){
situation = 3;
}

if (digitalRead(11) == LOW && digitalRead(12) == LOW){
situation = 4;
counter = 0;
}

if(situation != beginning){

  if (situation == 1){
    counter = counter + 1;
  }

  if (situation == 2 && counter == 1){
    visitor = visitor + 1;
    counter = 0;
  }

 if (situation == 3 && counter == 1){
   visitor = visitor - 1;
   counter = 0;
  }
}


if(situation != beginning){
if(situation == 4){
      lcd.clear();
      lcd.print(visitor);
}
}

if(situation != 4){
digitalWrite(13, LOW);
}
else {
digitalWrite(13, HIGH);
}

beginning = situation;       
}     
-----------------------------------------------------------------------------------------------
Blueprints:
First let's plug the lcd display:



More:
https://circuits.io/circuits/1376110-arduino-nano-lcd-test
https://circuits.io/circuits/1376110-arduino-nano-lcd-test#bom
https://circuits.io/circuits/1376110-arduino-nano-lcd-test#breadboard
-------------------------------------------------------------------------------------------------
Second let's connect the remaining:




-------------------------------------------------------------------------------------
Important informations:
LED sensors very hard detect the natural light IR content!
You need to put IR sensors in not transparent tubes (for example metal layer)!
With natural light  the radiant LEDs can be omitted (at experiment) or you need pull the curtain of the room when you do experiment without sensor LED house!
The sensor LEDs must be connected in reverse, the drawing is badly marked.
In fact, there is enough one radiate LED!

-------------------------------------------------------------------------------------
Adapter:
You need simple 9V 0.5A adapter.
+9 V connenct to VIN pin!
- connect GND!

https://www.modmypi.com/blog/how-do-i-power-my-arduino
http://playground.arduino.cc/Learning/WhatAdapter
------------------------------------------------------------------------------------

continuation soon