Hi, I am using a pixy and I wont to do a code that is going to put a servo to 0 to 180. If an object is detected during 0 to 180, stop the servo at the middle of the x position of the object.
: A servomotor is at 0 and during the time he is running to 180, if the x position of a block (the x position is 0 to 316(with pixy)) is equal to it middle (158), the servomotor stops.
while (var < 180)
{
pixy.ccc.getBlocks();
if (pixy.ccc.numBlocks)
{
int v = pixy.ccc.blocks*.m_x;*
if(v == 158)
{
break;
}
}¸
myServo.write(var);
}
It isnt working well. The servo is not stoping...
Please help me to adjust it
Thx for helping