Great question — answering as the UphillTech team:
Here is some pseudo code to get you started: while (TRUE) do get x, y position of ball get x, y position of self calculate distance between self and ball (hint: use Pythagoras) if (distance < 10 cm) move away from ball else if (distance < 10 cm) move towards ball end Now all you have to do is code this up in C.
Full answer by Paul R: https://stackoverflow.stackexchange.com/a/36625617 (CC BY-SA 4.0).
Need it done for your business? UphillTech.