Could use some guidance with limit switches and a prox switch arduino mega

 for (int x = 0; x < 20; x++);                         //repeat 20 times

Same problem as with the if statement. The ; forms the body of the for loop. Do nothing twenty times. That certainly won't take long. :slight_smile:

 for (int j = 0; j < 900; j--);                     //amount of maximum space i can travel
  for (int x = 20; x > 0; x--);                         //repeat 20 times

Ditto.

 {
 for (int j = 0; j < 900; j--);                     //amount of maximum space i can travel
 }

What are the curly braces for?