PDA

View Full Version : BOEBOT following using PIR



Darknight
05-26-2009, 07:33 AM
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

Mike2545
05-26-2009, 07:38 AM
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 (http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/PIRSensor-V1.2.pdf)

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

This message sent to you on 100% recycled electrons.

Darknight
05-26-2009, 07:54 AM
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.

SRLM
05-26-2009, 08:18 AM
http://forums.parallax.com/showthread.php?p=775638

Darknight
05-27-2009, 08:46 AM
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?

SRLM
05-27-2009, 10:08 AM
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.

Darknight
05-28-2009, 02:21 AM
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

Ugha
05-28-2009, 07:28 AM
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.