Quote:
Originally Posted by itsme
:::EDIT:::
I thought about it, and isn't it easier to calculate the exact tilt location according to the centroid_y (after the conversion to rotation, 239 centroid_y pixels are 255 rotation ticks--> 255/239=1.066... rotation ticks for each pixel. So if the centroid_y is let's say at 150, then the rotation has to be:
Code:
rotation=(int)centroid_y*(255/239); // or rotation=(int)255-centroid_y*(255/239); Depends on the centroid_y direction.
SetPWM(Port_2,rotation)
Same thing about the pan servo (but not necessarily with centroid_x).
Correct me if I'm wrong please.
|
I'm glad you got it. I'm a horrible teacher; I was just about out of ways to help you.
Yes, it seems that you've got the solution. Just make sure it indeed does work--test it thoroughly.
Good luck and feel free to keep asking questions. That's how you learn.
JBot