arduino motor control


Im just starting to use arduino so im sorry for stupid questions. i have 12v DC motor thats turns plate from horizontal to vertical, after it gets signal from pmr phone. i know how to do relay control but i need help with code. if i take wires from pmr-phone speaker and put it to analog input and determine it as trigger? so, after motor turns plate to vertical, theres little switch that signals arduino to stop keeping relay closed, how can i do this?

Please i need help :) my project is jamming becouse of this!


The loop() function is called in an endless loop. On each pass, use digitalRead to see if the limit switch has been pressed. If it has, open the relay.