Hi,
I have a biped robot that uses Arduino programing. It originally had an IR sensor to detect objects and walk towards them. I have replaced the IR sensor with the Pixy cam so it will only walk towards a certain object. The camera is installed on a panning servo and plugged into the ICSP on the Arduino board and it tracks objects perfectly using the “Pan Tilt” demo. However, I’m not sure how to replace the IR sensor in the code to the pixy. For example…
}
else if(detpos > 110)
{
Turn_Right(detpos);
scandir = 1;
}
else if(detpos < 75)
{
Turn_Left(detpos);
scandir = 0;
}
In my code with the IR sensor if the pan servo was turned greater than 110 the robot would turn right, less than 75 and it would turn left. How would I write this in the new code for pixy? Also, my current code is written like this…
Scan();
read_Ir();
What would I replace “read_Ir();” with?
I appreciate an helpful replies. At this point I’m just trying to get the robot to turn and face an object.
Thank you