Check the following. This presumes a I3 type machine where the bed moves in the Y Axis
Firmware: (presuming you have a ramp motherboard)
You have to set your reprap mother board to the correct type. #define MOTHERBOARD 33 for a normal ramps, or BOARD_RAMPS_14_EFB for new firmwares.
motors (as viewed from the front of the machine.)
move x in -ve direction head should move left, +ve direction head should move right.
move y in -ve direction bed should move back, +ve direction should move bed forward.
move z in -ve direction head should move down, +ve direction head should move up.
make sure these are correct (may not be able to move in negative direction until endstops work)
Endstop direction.
If your X end stop is on the left it is a min endstop, if its on the right its a max endstop.
if your Y end stop is at the back it a min endstop, if its on the front its a max endstop.
if your Z end stop is it the bottom its a min endstop, if its at the top its a max endstop.
Now set your homing direction to match your hardware
eg
// Sets direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1,
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1
Two wire switch type endstops
#define ENDSTOPPULLUPS needs to be set.
The switches should be wired from C and NC on the switch to S and - on the ramps.
NB Make sure if its a min endstop its on the min ramps pins and if its a max endstop it on the max ramps pins
use M119
This shows you what the controller sees for the endstops
manually test the endstops with a finger, don't home without knowing it works
When the endstop is hit, it should say triggered, when its not hit it should say open
If m119 shows its changing, but it triggered when its not or vice versa then change ENDSTOPS_INVERTING from true to false or false to true, ie opposite of what is it set to now.