Shop OBEX P1 Docs P2 Docs Learn Events
BOEBOT following using PIR — Parallax Forums

BOEBOT following using PIR

DarknightDarknight Posts: 4
edited 2009-05-27 23:28 in Accessories
Hi
I need help. I am trying to make the BOEBOT follow my hand around a maze. I have currently connected the PIR sensor to the BOEBOT. But currently i have no way of knowing if the PIR sensor is working or not .Can anyone provide sample bs2 code that will use's the PIR sensor and makes the BOEBOT follow my hand.

Any help is appreciated.
Thanks in advance

Comments

  • Mike2545Mike2545 Posts: 433
    edited 2009-05-25 23:38
    I don't think you can get it to work like that. There is sample code here www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/PIRSensor-V1.2.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike2545

    This message sent to you on 100% recycled electrons.
  • DarknightDarknight Posts: 4
    edited 2009-05-25 23:54
    thanks for replying Mike2545
    this might sound very obvious but Can someone explain to me if i want the BOEBOT to just turn on LED when motion detected and off when object idle. how do i setup the led and the jumper setting and how will the code code change from sample code above.
  • DarknightDarknight Posts: 4
    edited 2009-05-27 00:46
    hi
    thanks SRLM for the link.
    Yesterday using the test code I got the following result.

    Main:
    DO
    DEBUG HOME, BIN1 IN0 ' Display Status Of P0 At Home Pos.
    PAUSE 100 ' Small Delay
    LOOP ' Repeat Forever

    My BOEBOT doesn't still detect motion but it just keeps turning LED on and off when i put the output cable to the LED and if i attach the output to the pin0 on the debug terminal it just shows 1. i have played around with jumper setting but still had no luck. Can someone help me?
  • SRLMSRLM Posts: 5,045
    edited 2009-05-27 02:08
    What do you mean by output cable? You should just have a single signal wire going into PO. Also, don't forget to make the pin an input. I'm not sure what the default is, but it's good practice.
  • DarknightDarknight Posts: 4
    edited 2009-05-27 18:21
    thanks agian SRLM

    now i am using the single signal wire going into PO and still the problem remian it contenously changes from 1 to 0 and so on. but how do i·make·the·pin an input. here· is the sample code i used to test.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '--Warmup the PIR sensor
    LoopCounter VAR Byte
    FOR LoopCounter = 40 TO 1
    · PAUSE 1000
    NEXT
    DO
    DEBUG HOME, BIN1 IN0 ' Display Status Of P0 At Home Pos.
    ·' Small Delay
    LOOP ' Repeat Forever
  • UghaUgha Posts: 543
    edited 2009-05-27 23:28
    just put this:
    INPUT 0
    before the PIR warmup loop.
    That'll set pin 0 as an input, and thus actually read in the status to IN0

    This won't work for what you want though... the PIR has much to large of a
    detection field and much too much delay in each detection.

    Once you get the BOE detecting you may be able to get it to work somewhat
    by forcing the BOE to stop and wait a few seconds before going into detection
    mode. You won't be able to detect properly while its moving.
Sign In or Register to comment.