Shop OBEX P1 Docs P2 Docs Learn Events
PIR trigger time? — Parallax Forums

PIR trigger time?

hotrodhotrod Posts: 14
edited 2009-04-10 14:20 in BASIC Stamp
How can you program the PIR sensor to trigger longer than a few seconds? I am trying to make the PIR run a code that drives a stepper, but the way I have the "IFTHEN" statement the motor only runs when the PIR is triggered. I know that the PIR is only supposed to send a HIGH signal when it is triggered, that is why the "IFTHEN" statement does not work.........


How can you program the Bs2 to run a command when the PIR HIGH signaled is no longer sensed after it has been triggered?

here is a pseudo code:

-Look for PIR
-If, PIR tripped
-THEN flash LED for 10min

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-04-07 03:25
    You can write your code in such a way that the actual pulse length isn't an issue. How about posting what code you have (use attach) and get some specific suggestions?
  • hotrodhotrod Posts: 14
    edited 2009-04-07 05:45
    Here is the Pbasic.
  • FranklinFranklin Posts: 4,747
    edited 2009-04-07 18:39
    you need to write code that will start a subroutine to flash the light for ten minutes when the pir is high and then return to checking the pir. Put the pir check outside the loop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • hotrodhotrod Posts: 14
    edited 2009-04-10 14:20
    Thanks!!!! It worked!!!!!!!!!!!!!!!!!!!
Sign In or Register to comment.