if statement between pins?

I’m new to this but I need to use the arduino to create a delay in a solenoid activation after a switch is pressed. All the info I have seen on if statements so far has been in reference to serial port inputs. I am assuming that I need to have the switch set to a digital pin and use an if statement that says if that pin is at or greater than a certain voltage then delay for a set time and then send 5v to the pin that the solenoid is wired to?

Hello and welcome

Yes, but a digital input will not read a voltage but HIGH if input voltage is >= 2.3V or LOW if < 2.3V.

You cannot control the coil of the solenoid directly from an arduino output because it can only provide about 20mA (see here for more details).

guix:
Hello and welcome

Yes, but a digital input will not read a voltage but HIGH if input voltage is >= 2.3V or LOW if < 2.3V.

You cannot control the coil of the solenoid directly from an arduino output because it can only provide about 20mA (see here for more details).

Ok, using the HIGH LOW will work just fine but can I send 12v to the input pin or only 5? The solenoid will be activated by a relay that provides 12v but actuated by the 5v from the arduino. Id like to use that 12v supply for the input pin as well but I may have to use a 5v voltage regulator right?

essentially, I am trying to use the arduino as time delay relay in which I can control 2 time settings.

guix:
Hello and welcome

Yes, but a digital input will not read a voltage but HIGH if input voltage is >= 2.3V or LOW if < 2.3V.

If you read the specs it’s HIGH if > 0.6 * Vcc (3V) or LOW if < 0.3 * Vcc (1.5V). Values for Vcc of 5V. Between those two it might read either.

can I send 12v to the input pin or only 5? The solenoid will be activated by a relay that provides 12v but actuated by the 5v from the arduino.

Only 5V, but that 5V should not be used to power anything that requires more that 20 mA.

You must use a transistor and a resistor to activate the relay (with a flyback diode), as in this diagram:
arduino_relay.jpg

Also see this: http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/