RPi GPIO programming with Python 3
One of the main unique selling points of the RPi and similar single-board computers is the onboard GPIO pins. A few early models of the RPi boards have 26 pins. Most recent models have 40 pins for GPIO. We can obtain the details of the pins on a board by running the pinout
command on the Command Prompt. The following is the output of the command for my RPi 4B board:
In the top left, we can see the 40 pins for GPIO. Pin number 1 is labeled there. The red circle above it is pin number 2. The pin adjacent to pin number 1 is pin number 3, and so on. The following part of the output shows the numbering of all the pins:
As we can see in the preceding output, we have power pins (3V3
, 5V
, and GND
) and digital I/O pins, marked as GPIOxx
.
LED programming with GPIO
Now, we will see how to program LEDs...