Hi, i would be very glad if you can guide me for programming the Arduino for controlling In users:
i.e the Office door must be locked after 100th Users has assigned In (supposed a press button to access In is pressed 100 times)..Hence the door can be accessible (for last incoming user) if 1 User goes Out..
Plz advise..thx
What you will need to do is to write a program that allows you to see whenever a person goes in
and then make sure it knows when a person goes out.
if 'in-out' exceeds 100, then lock door.
if "in-out" lower than 100, then allow people to enter
glad to be of help.
Thx a lot Dave-In..
Where can i get a programming schema for this project plz?!
Look at this example "State Change Detection (Edge Detection) for pushbuttons".
Make that work with one button, and then add another button for counting down.
Then add a LED for "door locked", and perhaps one for "door open".
And at last adapt it to your own hardware.
After you download the free IDE software from this site, you can find examples of code
play with them and you will find out how to do lots of single tasks.
you can modify a task, or group tasks to create a larger sketch.
you want to count up as people enter
then count down as they leave
then compare the up count and the down count.
each of those is a task you should be able to figure out.
since you are apparently a beginner, what you will find is that the sensor is either the easiset or hardest part to find.
you will need a way to determine if a person enters. then figure a way to know when someone leaves.
if there are two different doors, then it is easier.
it can be very difficult to know when two people enter together, if it is one or two people.
also, it can be hard to know when someone is going in or out.
but take each step at a time. build on your knowledge and abilities.
when you stumble, post the code you have with what you want it to do.
before you post your code, read the 'How to use this forum' #7 about posting code using 'code tags'
you will need a way to determine if a person enters. then figure a way to know when someone leaves.
And that is going to be the hard part.
A button press to open the door is no guarantee someone enters, nor that it is only one person. People tend to be nice to each other and hold open the door for others that happen to want to enter at that time - or even that want to leave at that time.
But this sounds very much like a school project and I'm sure it can be idealised just fine.
Thx 'Leongjerland, 'Dave-in', 'WvMarle'...
In Fact i'm working on a parking lot project which has a maximum of 100 cars parks.
What i need is to block the In Boom-gate after 100th car is in and Exit boom-gate will count exit vehicles which will decrease the Entry Counts eventually.. (A led 'on' for hundredth car in and off for 1-99 will be ok for me)
But sequence to count Entry and decreasing it by Exit seems complicated to me!!
Any Ideas Plz...
You will have a variable called (say) carsInLot. A byte variable will work.
And two buttons, let's call them inButton and outButton.
When a car enters the lot press inButton. The program will add one to the variable carsInLot.
When a car leaves, press outButton. The program will subtract one from carsInLot.
The rest of it is easier. Get an arduino, and try this with two push buttons, and read ne value of carsInLot from the serial monitor.
When that works (or doesn't) come back here, and show what you have done, and ask for more help.
Remember to debounce those buttons, or you may get multiple counts for a single press.
And, remember to increment or decrement the count only when the appropriate switch BECOMES pressed (or released), not then the switch IS pressed.
See the state change detection example.
AND, wire the switches properly. The simplest way is to connect one leg to the digital pin and one leg to ground, and use INPUT_PULLUP as the pin mode.