Go Down

Topic: BI-DIRECTIONAL PEOPLE SENSOR AND COUNTER USING ARDUINO BOARD (Read 7 times) previous topic - next topic

Grumpy_Mike

So what happens when some one trips one sensor but then changes her mind an goes back and never trips the second one. Now providing the next person comes in from the opposite it will count backwards and continue to count backwards until some one makes a compleat transit from the original direction.

Graynomad

Quote
I was thinking of coding the arduino board to check the sequence in which the sensors were tripped and then decide whether to increment or decrement count.

Which is exactly what my code does. Here's a more verbose version that's possibly clearer to a C beginner

Code: [Select]
my_ISR () {

   // we got here because S1 was activated (and debounced in hardware)
   if (digitalRead(S2) == HIGH)
       count++;
   else
       count--;   // should test for < 0 as well

}


But as I alluded to in post #1 and Mike just explained more completely there are many pitfalls to this approach.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

dhenry

The more I read it, the more I admire my non-blind guy idea.

:)

stefanoGizz

Hi Rob,

I am making some good progress with my ISR and to start with am printing the count on the serial monitor.
Have also got a 3 digit common cathode display wired to arduino Mega 2560 and the code to count upto 0-999-0
therefore am wondering how do I call the counting code after the interrupts have occured so as to display the count/counter
(incrementing or decrementing) on the 3 digit seven segment display??

Much appreciated.
Steffano.

Graynomad

Quote
how do I call the counting code after the interrupts have occured so as to display the count/counter

That depends entirely on how you have the displays wired up.

Got a circuit diagram?

And how about posting your current code?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up