![]() | ![]() | ![]() |
| |||||||
| Robotics Chat Specific to discussions about robots and the making of. |
![]() |
| | Tools |
| | #1 |
|
Hello, I am currently working on making a robot that follows movement (people walking is my aim). I am using a boe-bot kit with a Basic Stamp 2 along with 3 PIR sensors (one on the front, one on the left and one on the right). So far I have the boe-bot constructed and everything's been tested and working; I just need to configure the PIR sensors so that when movement is detected by any of the 3 PIR sensors, the robot will follow the direction of that movement and when that movement stops, the robot will stop too. So, for example, when the left PIR sensor is detected, the robot should turn left to face that movement and then follow it until the movement either stops or changes directions. This is the code I have thus far, but I feel it's missing something(s). Perhaps someone knows of some revisions that may help make my robot follow direction more clearly. ' {$STAMP BS2} ' {$PBASIC 2.5} DEBUG "Program Running!" DEBUG "Initialize" PIRDetectLeft VAR Bit PIRDetectRight VAR Bit PIRDetectFront VAR Bit irDetectLeft VAR Bit irDetectRight VAR Bit pulseCount VAR Byte DO PIRDetectLeft = IN15 PIRDetectRight = IN12 PIRDetectFront = IN14 IF (PIRDetectLeft = 1) AND (PIRDetectRight = 1) THEN ELSEIF (PIRDetectLeft = 1) THEN GOSUB Turn_Left ELSEIF (PIRDetectRight = 1) THEN GOSUB Turn_Right ELSEIF (PIRDetectFront = 1) THEN GOSUB Forward_Pulse ENDIF LOOP Forward_Pulse: PULSOUT 13,950 PULSOUT 12,750 PAUSE 10 RETURN Turn_Left: FOR pulseCount = 0 TO 10 PULSOUT 13, 750 PULSOUT 12, 750 PAUSE 10 NEXT RETURN Turn_Right: FOR pulseCount = 0 TO 10 PULSOUT 13, 950 PULSOUT 12, 950 PAUSE 10 NEXT RETURN Back_Up: FOR pulseCount = 0 TO 10 PULSOUT 13, 750 PULSOUT 12, 950 PAUSE 10 NEXT RETURN | |
| |
|
| Tags |
| motion, pir, robot, sensors |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| which kind of sensor should i use ??? | mohmoh | Robotics Chat | 7 | 17th March 2009 09:29 AM |
| robot sensors; reach target but fast | LameMe | Robotics Chat | 6 | 14th March 2009 07:23 AM |
| Robot wars!University of Cape town Mechatronics project | riki4eva | Electronic Projects Design/Ideas/Reviews | 7 | 28th June 2008 06:53 AM |
| wireless PIR motion sensor | arod | Electronic Projects Design/Ideas/Reviews | 3 | 9th February 2007 10:32 PM |
| Motion Sensors | hdaroga | Electronic Projects Design/Ideas/Reviews | 1 | 12th September 2005 06:32 PM |