官术网_书友最值得收藏!

Accessing Raspberry Pi GPIO pins via wiringPi

Since we have installed wiringPi, we can now look at the wiringPi pin numbering, as shown in the following screenshot:

The Physical column represents the Raspberry Pi numbering from 1-40. On both sides of the Physical column, you will see the wiringPi (wPi) columns. The arrows pointing from the Physical column to wPi represent the wiringPi pin numbering for a particular physical pin of a Raspberry Pi.

Take a look at the following examples:

  • Physical pin number 3 has a wiringPi pin number of 8
  • Physical pin number 5 has a wiringPi pin number of 9
  • Physical pin number 8 has a wiringPi pin number of 15
  • Physical pin number 11 has a wiringPi pin number of 0
  • Physical pin number 40 has a wiringPi pin number of 29

By consulting this table, you can figure out which of the remaining physical pins correspond to which wiringPi pins.

wiringPi pin numbers from 17-20 do not exist. After wPi pin 16, we skip straight to  wPi pin 21.

To better understand the relationship between the wiringPi pins and the physical pins, you can refer to the following diagram: 

The wiringPi pin numbering is what you will need to remember while programming. We can use a total of 28 wiringPi pins for programming. As well as these, we have the following pins, which can be used for providing power and can be used as ground pins:

  • Physical pin numbers 6, 9, 14, 20, 25, 30, 34, and 39 are ground pins
  • Physical pin numbers 2 and 4 provide a +5V supply
  • Physical pin numbers 1 and 17 provide a +3.3V supply

Let's move on to writing our first C++ program for Raspberry Pi. 

主站蜘蛛池模板: 自贡市| 长汀县| 万全县| 中西区| 灵璧县| 美姑县| 尖扎县| 马公市| 红桥区| 宣化县| 新巴尔虎左旗| 林芝县| 南充市| 四平市| 鄂托克旗| 潜山县| 灵川县| 蓬安县| 社旗县| 曲沃县| 绿春县| 诸暨市| 江孜县| 金阳县| 句容市| 湾仔区| 沂水县| 宜兰县| 阿勒泰市| 武鸣县| 连江县| 横山县| 望都县| 青川县| 庆城县| 牙克石市| 贞丰县| 吉木萨尔县| 青浦区| 图木舒克市| 华安县|