If you are having difficulties with your homing switches you can do a quick test with Grbl to see what the state of the homing switches is from Grbl's point of view. NOTE: In order to use this procedure you need to have grbl Version 0.9j or later installed on your Arduino.
To do so, you use the Grbl status immediate command ? (question mark). This command asks Grbl for its current value of some of its state information. For the purpose of this article we are interested in the homing switch state.
Not all Grbl access programs will pass Grbl immediate commands to the Arduino. UGCS is one of the programs that does not send the immediate commands when you enter them in the "Command Tab". You can use a terminal program like HyperTerminal or Putty to perform this function. Also, the Serial Monitor in the Arduino IDE will send the immediate commands.
Before we can get the information we want we have to tell Grbl that we want to see the state of the homing switches. In order to get this report you have to change the "status report mask" in Grbl. The default setting for the status report mask is 3. This causes Grbl to report the Machine Position and the Work Position. If you have not homed your machine or otherwise initialized your machine these values will be meaningless until your machine is initialized.
To request the homing switch state you turn on the bit associated with the switches in the status report mask. The bit to turn on is bit 4 which is equivalent to decimal 16. So, you would add 16 to the 3 that is the default setting to get 19. Set $10=19 to turn on the reporting function for homing switches.
Now when you issue the status immediate command (?) the return message will include the state of the homing switches (LIM=000). This value represents the normal case with no homing switch tripped. The order of the report is ZYX. So, a report of LIM=010 would indicate that the Y axis homing switch is tripped. Similarly, LIM=111 would indicate that all of the homing switches are tripped.
To test your switches you would issue a status command and note the return value. If you are using normally open switches the return should be LIM=000 if none of the switches are tripped. If it is not zero then you need to determine why before you proceed. Then you would press and hold one of the switches while you execute the status command again. This time you should see the switch you pressed as tripped. Repeat this for each switch.