This Instructable will show you how to install the GPIO package on your Raspberry Pi and how to wire up a simple push button circuit with an LED.
I use the command-line and Python for this, no web browser or GUI.
Before you do this Instructable, make sure you have your Raspberry Pi ready for action. My Ultimate Raspberry Pi Configuration Guide covers how to do this in detail.
You will want to have an internet connection to download the packages and probably use ssh.
Step 1: Gather your components
* Raspberry Pi
* Cobbler breakout board with cable — you can order this from Adafruit for $8.
* Wires — breadboard or otherwise
* standard LED
* 270 Ohm resistor
* 1K resistor
* 10K resistor
* Push button
* USB power for RPI (not pictured)
* Monitor + keyboard (not pictured)
* small diagonal snips
* multimeter for checking continuity
Step 2: Assemble your circuit
Here is the schematic and breadboard diagram.
The LED is straightforward: 270 Ohm resistor is needed to light up the LED from a 3.3V input.
The concept is simple: the LED is an output of pin 4 and the button is an input of pin 22. The button circuit has a pull-down resistor. Pin 22 will be pulled down to zero through the 10K resistor when the button is inactive. When it gets pressed, the 3.3V power from the Raspberry Pi goes into the pin 22 input, bypassing the 10K resistor.
Without the 10K resistor, you'll have a floating input and will get erratic behavior in your code. The 1K resistor protects the Raspberry Pi from too much current.