AnsweredAssumed Answered

BI-DIRECTIONAL COUNTER USING 2 IR SENSORS (IN & OUT)

Question asked by StefanoG Gizzler on Dec 4, 2012
Latest reply on Dec 5, 2012 by Tony Papadimitriou

Hi All,


I am building a directional people sensor and counter in a room using two infrared sensors (S1 and S2) which have a quadrature output such as the rotary encoder.What I want is the first sequence on breaking S1 and S2 the change should signal entry by incrementing a counter whilst breaking the beam in the second sequence S2 first and S1 will signal exit and decrement a counter.


Does anyone have an idea if this is the right way to code this on a 8bit Microcontroller? Or which is the right way to go??

Code attached.


Thanks

Outcomes