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

Installing the wiringPi library in the Raspberry Pi

wiringPi is a pin-based GPIO access library that is written in C. Using this library, you can control the Raspberry Pi using C/C++ programming. The wiringPi library is easy to set up. Once installed, the Raspberry Pi GPIO pins will have wiringPi pin numbering. Let's take a look at how to download and install wiringPi:

  1. First, open the Terminal window by clicking on its icon from the taskbar:
  1. Before installing the wiringPi library, we first need to verify that our Raspberry Pi is up to date by checking for updates. If your Raspberry Pi is not updated, you may face errors while installing the wiringPi library. To update your Raspberry Pi, type the following command:
$ sudo apt-get update

The output of the preceding command can be seen as follows:

Depending on your internet speed, it will take around 10-15 minutes for the updates to download and install. Make sure that you place your Raspberry Pi near your Wi-Fi router.
  1. After the update, type in the following command to upgrade the Raspberry Pi:
$ sudo apt-get upgrade

While upgrading, you may get a message asking you to download a particular component. Type Y and then press Enter. It will take around 30-40 minutes for the upgrade to complete. Once the upgrade is done, you will see the following message:

  1. After updating your Raspberry Pi, you will need to download and install git-core inside your Raspberry Pi. To install Git, type the following command:
$ sudo apt-get install git-core
  1. After this, to download the wiringPi library from git, type in the following command:
git clone git://git.drogon.net/wiringPi
  1. Now, if you click on the File Manager option and click on the pi folder, you should see the wiringPi folder:
  1. Next, change the directory to wiringPi, so that the wiringPi files are downloaded and installed inside this particular folder. The command for changing the directory is cd:
$ cd ~/wiringPi (The ~ symbol is above the Tab key and it points to pi directory)

You should now see the directory pointing toward the wiringPi folder.

  1. Next, to fetch the Git files from their origin directory, type in the following command:
$ git pull origin
  1. Finally, for building the files, type in the following command:
$ ./build 

Once everything is done, you will see an All done message:

Now that we have installed the wiringPi library, we can move on and understand wiringPi pin configurations on the RPi.

主站蜘蛛池模板: 剑川县| 治县。| 鸡东县| 凌云县| 鹤壁市| 淄博市| 阜南县| 沁水县| 吴忠市| 安达市| 平泉县| 镇远县| 绥芬河市| 榆林市| 松江区| 津市市| 延边| 阳新县| 巴楚县| 焦作市| 乌兰察布市| 牙克石市| 喜德县| 甘洛县| 留坝县| 玛曲县| 德令哈市| 资兴市| 天等县| 富平县| 华坪县| 壤塘县| 乌兰县| 元江| 迁西县| 三原县| 贞丰县| 泌阳县| 旅游| 留坝县| 丹阳市|