Broken IF statement?
cjolson140
Posts: 5
Hi,
I'm trying to program my BS2 so that it will count the number of people walking past the IR sensor and emitter. The SEROUT commands are for the 4x20 LCD i'm using. For some reason, whenever I run it, the PEOPLE varible never has anything added to it. Thanks.
Caleb
I'm trying to program my BS2 so that it will count the number of people walking past the IR sensor and emitter. The SEROUT commands are for the 4x20 LCD i'm using. For some reason, whenever I run it, the PEOPLE varible never has anything added to it. Thanks.
Caleb
Comments
·· A closer look at your code leads me to believe that your SEROUT is causing the problem.· You should move the SEROUT 0 since the reflected IR wouldn't be detected that much later.· You're testing for the received IR after you do other things.· The check for IN9 should come immediately after the FRQOUT command.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks! I'm doing this for a school project and this really helped!
Caleb
This isn't a very good application for reflected I/R, for any number of reasons. Here is the way I would approach this, with almost the same parts you're using now.
You would obtain much better and more accurate results if you had a 555 timer IC drive your I/R LED at the appropriate frequency, then have the pulsed I/R beam point to the I/R receiver. Now you check for when the beam is BROKEN at the I/R receiver, to count the individuals. Each beam break is one person. This will give you very accurate results, and is somewhat self-immune to external interference.
Somewhat needless to say, the people would need to be passing in single file, and not in groups. You can use any CMOS camera (aka digital camera or video cam) to align the IR beam accurately. The camera will make the otherwise invisible I/R beam visible on the video screen.
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 2/2/2006 7:30:24 PM GMT