Reading a sensor and outputting the result to a motor or relay are two different things.
Read the sensor state, and make it turn the onboard pin13 LED on/off first.
Then worry about relays and motors.
If you already have written code, post it.
Leo..