Sensing an external voltage which switches between 12V and 0V

Great. Thanks for all the help.