12 volt input

Am i correct in dealing with 12 or any volt input. On my generator when the 12 volt run light comes on I want it to input to pin 3. Can i run the 12 volt to a relay and on the other side use the board 5 v pin to input to pin 3.

Yes, you can use a relay contact between pin and ground of the Arduino, with internal pull up enabled.
And the (12volt) relay coil driven by the 12volt device.

Another way is an opto coupler.
1-10k resistor in series with the opto LED.
Opto transistor between pin and ground, also with internal pull up on the pin enabled in pinMode().
Leo..

Yes you can use a relay but it's kind of a large, expensive and power-hungry way to solve a simple problem.

Read up on "voltage dividers".

Also read up on the protection diodes that exist on every single Arduino input pin.

Now design your divider and consider what might happen if it's hooked up wrong - what if it's connected to 24V or hooked up backwards. How much current flows through that protection diode? While the specs on the diodes are impossible to pin down, the accepted advice seems to be to keep the current in the diode under 2mA. Choose divider resistors that will keep this current low under most reasonable fault conditions.

I would prefer an opto coupler over a relay or voltage divider.
A relay on a vibrating generator might have a lot of contact bounce (which to can bridge with code).
And a voltage divider could have unwanted groundloops (depending on how you power the Arduino).
Leo..

ddutton:
Am i correct in dealing with 12 or any volt input. On my generator when the 12 volt run light comes on I want it to input to pin 3. Can i run the 12 volt to a relay and on the other side use the board 5 v pin to input to pin 3.

Have you determined the voltage on the lamp is DC or is it AC?

Paul