The challenge is for a robot to go around the perimeter of a rectangular field and execute 90 degree turns when it gets within 4.5 inches of a wall. Simultaneously, if the bot encounters a red flag, it needs to stop until the flag color turns green. At that point, the arm holding the color sensor needs to dip to avoid the traffic signal, and once it is passed, continue on it's way.
I have tried running two threads, one where the bot encounters a flag (which I have constructed a switch for cases red and green), while the other is where it encounters a wall. I think these two threads need to be encased within an infinite loop, but I can't seem to make it so.