Pixy(CMUcam5) robot Distance code Can anyone help me with the code-ing to allow the robot to stop at a certain distance when the robot is approaching the tracked object. I am trying to implement it as a colour tracking wheel chair. For Example, the motorized wheelchair is able to track the colour of the shirt of the person infront is wearing and follow the person, and at the same time it is able to leave a distance between the person infront and the wheelchair to prevent collision.

the pixy robot : https://learn.adafruit.com/pixy-pet-robot-color-vision-follower-using-pixycam/overview

The code :https://learn.adafruit.com/pixy-pet-robot-color-vision-follower-using-pixycam/the-code

Currently the code is only able to track the object till it reaches the object. But my objective is to let it chase the object, but at the same time, leaving a 1 metre distance
away from the object.

Please help me. Thank you
Try to play with this one:

int forwardSpeed = constrain(400 - (size/256), -100, 400);


By changing the value of 256 and 400, not at the same time though, you better use 2 potentiometer to change those values. That's a trial and error though, I hope this will give you an idea.