I would first check the connections at the headers on the ramps board, for both motors and optos. Do they slide on and off of the pins easily? If so, you may not be making good electrical contact. Make sure the sockets are pushed fully into the connector.