change line search routine to a mini state machine, prevents blocking the main loop with delay()s and allows collisions to always be detected