I am using Arduino UNo, IR sensor and 16*2 LCD display, I have done almost but both the sensors are reading during IN and OUT instead of (In during entry and OUT during Exit).
Any one have sketch/code
Kindly help
I am using Arduino UNo, IR sensor and 16*2 LCD display, I have done almost but both the sensors are reading during IN and OUT instead of (In during entry and OUT during Exit).
Any one have sketch/code
Kindly help
Hello
Post your schematic and sketch, well formated, with comments and in so called code tags "</>" to see how we can help.
#include<LiquidCrystal.h>
int Contrast = 60;
LiquidCrystal lcd(12,11,10,9,8,7);
#define in 4
#define out 3
int count=0;
void IN()
{
count++;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
delay(1000);
}
void OUT()
{
count--;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
delay(1000);
}
void setup()
{
lcd.begin(16,2);
lcd.print("Visitor Counter");
delay(2000);
pinMode(in, INPUT);
pinMode(out, INPUT);
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
}
void loop()
{
if(digitalRead(in))
IN();
if(digitalRead(out))
OUT();
if(count<=0)
{
lcd.clear();
lcd.clear();
lcd.print("Nobody In Room");
lcd.setCursor(0,1);
delay(200);
}
Here I am using UNO instead of Nano
How are the sensors positioned?
Often, they would be one ‘inside’ and one ‘outside’, then whichever is triggered first determines the direction.
The second sensor confirms completion of the journey.
If the second isn’t triggered, the process times out (target stopped in the middle), or the person has given up and retriggered the initial sensor to step back (neither in or out !
I have fixed them on one side DFMD frame (Both edge)
I am fully new for the project and coding, just i have seen some projects and try to done it, but failed to complete it , if possible kindly correct the shared sketch/code.
it will be very help full to me to complete the project.
Please draw it, take a photo and post it here.
How far are the sensors apart?
Which sensors do you use? Link to datasheet please.
Try to simulate by using e.g. buttons (or wires) instead of the sensors; use a pull-down resistor to prevent the input from floating.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.