Raspberry Pi 3 Starter Kit Hookup Guide
Reading Inputs and Toggling the LEDs
This section contains instructions for getting the software necessary to compile programs that use the GPIO, then redirects to our Raspberry gPIo tutorial.
Getting WiringPi for Using C++
The WiringPi library is required to operate the GPIO with C++. There are two methods to get it, mentioned below. Either way, it will have to be built before use.
Get From the WiringPi
git://git.drogon.net/wiringPi" is not available.
Wiring Pi is previously not included with early versions of Raspbian. This required users to download and install it. Luckily, Wiring Pi is included in standard Raspbian systems. If you are looking to update using a mirrored Wiring Pi with small updates to support newer hardware, we recommend checking out this GitHub repository.
You'll need git (may be installed by default). If git is not installed, enter the following into the command line.
language:bash sudo apt-get install git-core
We highly recommend using Git to download the latest version. To check what version you have, enter the following command.
language:bash gpio -v
If you receive an output similar to to the following with the
Unknown17, you'll want to update WiringPi on a Raspberry Pi 4 or above.
language:bash gpio version: 2.50 Copyright (c) 2012-2018 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Raspberry Pi Details: Type: Unknown17, Revision: 02, Memory: 0MB, Maker: Sony * Device tree is enabled. * --> Raspberry Pi 4 Model B Rev 1.2 * This Raspberry Pi supports user-level GPIO access.
Enter the following to remove the wiringPi and configuration files.
language:bash sudo apt-get purge wiringpi
Then type the following for the Pi to remove all locations that remember wiringPi.
language:bash hash -r
As long as you have Git installed, these commands should be all you need to download and install Wiring Pi.
language:bash git clone https://github.com/WiringPi/WiringPi.git
This will make a folder in your current directory called WiringPi. Head to the Wiring Pi directory.
language:bash cd WiringPi
Then pull the latest changes from the origin.
language:bash git pull origin
Then enter the following command. The
./build is a script to build Wiring Pi from the source files. This builds the helper files, modifies some paths in Linux and gets WiringPi ready to rock.
At this point, the library should work. Run the
gpio command shown below to view some information about the wiringPi version and the Pi that it is running on.
language:bash gpio -v
Entering the following command will draw a table illustrating the configuration for the pins in the 40-pin connector.
language:bash gpio readall
Raspbian comes with Python pre-installed. Continue to the gPIo tutorial to find out how to use it.
Using the GPIO.
This excellent tutorial covers all the INs, OUTs, and PWMs of GPIO with the Pi platform.