Raspberry Pi Raspberry Pi GPIO introduction notes 06- and wiringPi libraries installed

Raspberry Pi development board provides a number of GPIO pins, which leads through 40Pin the pin, only the earlier version 26Pin. Removing the outer GPIO pin, 5V / 3.3V power and ground pins, also provides a SPI, UART and IIC interface, a new version of the ongoing development of the extended function board based on the original.

### 1. GPIO numbering

Raspberry Pi GPIO port number exists in three different ways:

  • Physical "BOARD" numbering:

From left to right, top to bottom, left an odd number, the right side of the even-numbered 1-40. The advantage of this numbering is that no matter how the development board version changes, our hardware can work without having to reconnect.

40pin

  • BCM numbering:

Refers to the number on the GPIO Broadcom onboard CPU, CPU registers focus. Since the CPU has a large number of pins, the internal assigned pin numbers and pin number is inconsistent board.

BCM number

  • wiringPi numbering:

Focusing on implementation logic, leads to the external GPIO ports are numbered from 0, the program is very easy to prepare.

40Pin table

2. wiringPi library introduction

wiringPi by Gordon C language library, at first mainly as a BCM2835 chip GPIO library, and now very rich, remove GPIO library, the library also includes IIC, SPI library, UART software library and PWM libraries.

wiringPi library is ideal for those with a C foundation, before contact with or embedded microcontroller development crowd. Arduino and its API functions are very similar, which makes it be greatly welcomed.

3. Install wiringPi

1. Log into the Raspberry Pi remotely over SSH, then enter the following command to update each raspberry pie packages and dependencies to the latest version.

sudo apt-get update
sudo apt-get upgrade

update

2. Install

wiringPi preinstalled in the standard system to send raspberry, may enter a command to update or install.

sudo apt-get install wiringpi

Installation wiringPi

3. Test

wiringPi gpio comprising a set of commands using the command to control the respective interfaces gpio raspberry School.

Enter the following command to display information about the current wiringPi library version and the current development of Raspberry Pi boards.

gpio -v

version

Enter the following command to obtain the corresponding pin table.

gpio readall

Print pin information

Focus on micro-channel public number: TonyCode
the Arduino learning exchange group: 868 283 450

More, I welcome the attention of the public number. Sweep the micro-channel to follow the Fanger Wei code:
Micro channel scan code added public number: TonyCode

Published 63 original articles · won praise 250 · Views 230,000 +

Guess you like

Origin blog.csdn.net/TonyIOT/article/details/103005228