The commonest problems are a mismatch between the GPIOs being physically used and the GPIOs the software is told to use.
There are at least three different numbering schemes in use.
- Broadcom GPIO number: the GPIO is identified by specifying its
Broadcom number. The end user needs to check where (if at all) the
GPIO is connected to the expansion header.
- Pin number: The GPIO is identified by the expansion header pin
number. Note, that not all pins are connected to GPIOs. Some are
connected to the ground, 3V3, and 5V power rails.
- wiringPi number: The GPIO number is identified by a "logical"
numbering scheme which is neither of the above.
Different software libraries support one or more of the above schemes. You need to check then double check if your circuit does not work as expected.
Additional problems are introduced by cobblers and ribbon cables.
A ribbon cable connected to a cobbler may be inserted the wrong way around at the Pi end or the cobbler end. If you have a meter check that the breadboard gives 3V3 and 5V at the expected points.
If you use a ribbon cable by itself then the columns may have been swapped. i.e. on the Pi pins 1, 3, 5, etc. (odd numbered pins) are on the left. On the ribbon cable the odd numbered pins may be on the right. If you have a meter check that the cable gives 3V3 and 5V at the expected points.
As Phil B. points out take some care when choosing a ribbon cable. An old style 40 pin 40 wire IDE cable will be fine, however the later style 40 pin 80 wire IDE cables will damage the Pi. The 80 wire IDE cables have internal connections which will connect Pi pins which should not be connected.