Board Resets when analog pin voltage drops

I have a higher voltage component (24V solenoid) controlled by a push button. I want my board to take a reading when I release the button. When I test the circuit using a 5V supply from the board it works fine, but once I connect the higher voltage (with resistors to reduce voltage and amperage to a level the board can handle) the board will reset whenever I release the button. I have attached my circuit diagram and code. Not pictured is a thermal sensor attached to A0 and the 5V supply from the board, but the outcome is the same with or without the sensor connected.

I am assuming there's something dumb and obvious I'm forgetting to account for.

I wasn't able to post this to a specific topic, such as Project Guidance, as the New Topic button wasn't there.

Button_Record_Temp.ino (917 Bytes)

Please Read this before posting a programming question and follow the instructions given about posting code

maxillosr:
When I test the circuit using a 5V supply from the board it works fine, but once I connect the higher voltage (with resistors to reduce voltage and amperage to a level the board can handle)

you really need a regulator because the processor board voltage voltage will fluctuate depending on the current being drawn threw the resistors as well as fluctuations on the 24V depending on how much current it is supplying.