Thanks for getting back to me so quick. This is the circuit I am looking at building. I’ve read online to build the circuit. Can you tell me if it is correct?

Also I dont understand why it works and im hoping you can correct my thinking. Following ohms law we want to leave 5v when 20 milliamps goes through the circuit. We know the voltage on the circuit is 24 volts and we know the maximum current is 20 milliamps so my maths says :

Resistance = Voltage / I (current)

We need to leave 5 volts for the arduino to read so we subtract 5 from 24.

Resistance = 19 / 20 milliamp

So the resistance to leave to give us a maximum of 5 volts is a 0.95 Kilohms resistor. I dont see where the 250 ohm resistor comes in? please help.