Stonybrook University MEC 101 HW#10 Programming Help

i need the code to tell my arduino uno that when the left limit or right limit switch hits an object an object the robot will move backwards for 5 seconds, turn right for five seconds, and continues forward.