Door Counter


I have to write a program for a project that will detect when a person enters or exits a room. The sensors that are being used are LDR's detecting laser beams. There will be 1 sensor on the outside of the door and another one on the inside of the doorway. What i want the program to do as a person enters and beam 1 is broken followed by beam 2 it will +1 to the count. If some one exits and beam 2 is followed by beam 1 it will be -1 form the count.

At this stage i have been able to get them to both work at the same time but i have not had any luck with the counting or having the program follow which one has been broken. What would people recommend in regards to code structure for such a program?



Post your current working code online.