I have the Freetronics Eleven, which is 100% compatible with Arduino Uno. Ultimately, I want to make a foot pedal switch that connects to a digital pin on the arduino so that a LOW is read when the pedal is pressed, and a HIGH is read when the pedal is released, or vice versa.
At the moment I'm just trying to test making a switch of the same behavior by sticking wires in the pins and connecting them together. I've tried connecting and disconnecting pin 2 and gnd, pin 2 and 5v, pin 2 and pin 12 etc. with pin 2 set to input.
What is the correct setup to make a basic switch? Which pin do I connect to which to make it so when the pins are connected one reads low instead of high, or vice versa?
EDIT: Thanks for telling me about the pull-up resistor. I have since discovered via google that the arduino pins have built-in pull-up resistors. For others who come along this problem, this is how you enable them:
pinMode(10, INPUT); // set pin 10 for input
digitalWrite(10, HIGH); // set pull-up resistor on pin 10
then to use:
if (digitalRead(10) == LOW) // pin 10 is connected to gnd
doSomething();
else // pin 10 is not connected to gnd
doSomethingElse();