A stimulus is detected by a sensory receptor, e.g. pain detected by a pain receptor when the arm touches a sharp pin etcThis causes a nerve impulse to be created which travels along a sensory neurone to the spinal cord.The sensory nerve synapses with an relay neurone and the impulse was transmitted across.THe relay neurone transmits the impulse from the back of the spinal cord to the front of the spinal cord to a motor neurone.the motor neurone carries the impulse to the effector muscle which causes the muscle to contract.This pulls the arm away from the pin.