Detecting if something like a motor is on or a switch has been turned on.

I have an arduino program that reads the air temp and sends it to the computer. I want to be able to add to that a small bit of code which lets me detect if a switch has been made. My plan is to be able to detect if a pump has come on. Can anyone advise me what pins i would connect the switch to and what code i could use to detect it being turned on. THanks

Is it a digital switch (off or on)? If so, any digital pin can be used, and digitalRead() used to read the state of the switch.

If it's an analog switch, use an analog pin and analogRead() to read the value.

Of course, this all presumes that you connect the ground side of the switch, too, and that the voltage in the switched circuit is between 0 and 5V DC at all times.

My plan is to be able to detect if a pump has come on. Can anyone advise me what pins i would connect the switch to and what code i could use to detect it being turned on. THanks

Do you mean that you want to detect the position of an already existing switch that is wired to and controlling a pump on and off?

Lefty