Shop OBEX P1 Docs P2 Docs Learn Events
Pir sensor — Parallax Forums

Pir sensor

speakers2010speakers2010 Posts: 6
edited 2010-04-27 04:08 in BASIC Stamp
I took the sample PIR sensor code from parallax and im trying to make my boe bot drive everytime it sees something move and I cant seem to get the program right.· The program I wrote just doesnt seem to work.

' =========================================================================
' File...... PIR_Simple.bs2
' Purpose... Show Output State Of PIR Sensor
' Author.... Parallax, Inc.
' E-mail.... support@parallax.com
' Started... 12-14-2005
' {$STAMP BS2}
' {$PBASIC 2.5}
'
'
[noparse][[/noparse] Program Description ]
' This program displays the current state of the PIR Sensor connected to P14
' on the DEBUG screen.
'
[noparse][[/noparse] Program Code ]
Main:
DO
DEBUG HOME, BIN1 IN14 ' Display Status Of P14 At Home Pos.
PAUSE 10 ' Small Delay

IF IN14 = 1· THEN
· PULSOUT 12, 650
· PULSOUT 13, 850
ENDIF

LOOP

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-04-25 16:09
    What output do you get from this program?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • speakers2010speakers2010 Posts: 6
    edited 2010-04-25 16:16
    its randomly goes 0 and 1 in a constant loop no matter if i move or not
  • Possum79Possum79 Posts: 30
    edited 2010-04-26 04:38
    I was going to say the same thing about calibration time. When you start your program you should really have a warn up time for the PIR. The data sheets recommend 10-60 seconds. I notice when I was using mine it would trigger randomly untill it had time to adjust to the room. That was kinda of what silverback said though. I was going to use two pir sensors at different front angles to chase my cats but have yet to mount them to my boe-bot.
  • speakers2010speakers2010 Posts: 6
    edited 2010-04-26 18:59
    i have the pir sensor set on the low jumper. Can anyone give me the code to do this
  • speakers2010speakers2010 Posts: 6
    edited 2010-04-26 18:59
    i have the pir sensor set on the low jumper. Can anyone give me the code to do this
  • Possum79Possum79 Posts: 30
    edited 2010-04-27 04:08
    Check out the advanced PIR code in the http://www.parallax.com/Portals/0/Downloads/src/prod/PIR-Demo-Code-V1.0.zip. It pretty much shows you how to use the proper delay and determine when its triggered. Sounds like with your jumper setting on LOW it will trigger quickly when it keeps seeing motion. To me I would want the jumper on HIGH so when ever there is motion detected it doesnt·quickly·go high/low it would just stay high.·It would keep your motor pin high instead of bouncing high/low quickly resulting in jerky motion.
Sign In or Register to comment.