Connecting switches to the BeagleBone
So far, we have mostly looked at outputs from the BeagleBone. Let's look at getting the physical input. The switches that we are talking about here are simple mechanical devices that can open or close a circuit. They can be push button switches such as the user or reset button on the BeagleBone, or they can be slide switches. They can also be sensors. For example, you can detect tilt by having a metal ball sitting between two wires in a box. When the box is tilted, the ball rolls away and opens the circuit. All of these are interfaced similarly. One important thing to remember is that these switches are passive. They do not have power. The following diagram shows a sample switch connection (SW1) to a GPIO:
A passive switch can be connected to the BeagleBone's GPIO by connecting one terminal of the switch to ground and the other end to 3.3V through a resistor. The GPIO is connected to the resistor on the side connected to the switch. The resistor is large...