My robot is travelling along a narrow coridoor. At the point where it has to turn into a room, i want to have an IR transmission @38KHz. I got the IS1U60 IR reciever (by Sharp?) that detects IR only @ this frequency. I'm planning to mount the reciever on the side of my robot.
My detector output will remain High and when it detects the IR @ 38KHz, it will go Low. So basically my robot will be going forward, and as soon as the detector goes low, the robot has to make the turn.
I have two methods in mind and not sure which would be work best.
1. Connect the detector output to portb (pins 4-7) and Use an interrupt (portb<4:7> change). So the 'forward routine' of the robot is interrupted and made to go into a 'turn routine'.
(Also note portb0,1,2,3 are connected to my hbridge for my motors and i'm also using a bumper switch (interrupt) on portb.5. This setup works perfectly so far.)
-OR-
2. During my 'forward routine, just use an IF loop to keep checking if my detector is high or low?
In the second case do i HAVE to use ADCON? and if i DO use ADCON, will I HAVE to connect my detector to port RA or RE? Or can i still use port RB? (VCC for my detector and PIC is 5V)
Thanks,
Samuel
Bookmarks