Yet another Camera thread...

For the past few days / week, I’ve been trying to get the camera code to work. This code I have made is a variation of the sample code provided. As an FYI, the Target.h and Target.cpp is a copy and paste from the sample code.

The code seems to recognize a target… when it sees pink above green (or was it green above pink?), the servos slow down significantly and then once the target is out of sight, it keeps on moving at a normal speed.

Help is appreciated,

EDIT: Seems like “Track.h” needs to go after “TrackAPI.h”. Still, there’s likely something wrong w/ the code. (12.3 KB) (12.3 KB)

The most likely case of this problem is that the sign of the horizontal direction is backward. When the two color demo sees the target it tries to step slowly until it is in the target is in the center. If the step value is backward it actually moves away from the target. Once the target is out of the image, the normal panning, which is faster, will kick in.

Do you mean changing:

incrementV = verticalDestination - verticalPosition;


incrementV = verticalPosition - verticalDestination;

Now I wish I read the comments :frowning:

// TODO: Check to see if this needs to be reversed
// you may need to reverse this based on your vertical servo installation