Need help coding a line tracker

Does anyone have some code for a line tracker that I could copy for my robot to detect a ball and stop the intakes once the ball is detected?