The delay 1000 during your scans are halting the code for a second at a time. Nothing processes during that time. I skipped the interesting appearance of a servo scanning front sensor for a more practical solution of 3 fixed sensors. The moment one sensor triggers the need for a decision, the data to make that decision is already there and it can be made without pausing.