April 2017
Beginner to intermediate
312 pages
7h 23m
English
We will make use of the python3-gpiozero library (https://gpiozero.readthedocs.io/en/v1.3.1/). The Raspbian Jessie OS image comes with the pre-installed library. It is very simple to use, and it is the best option to get started as a beginner. It supports a standard set of devices that helps us get started easily.
For example, in order to interface an LED, we need to import the LED class from the gpiozero library:
from gpiozero import LED
We will be turning the LED on and off at a 1-second interval. In order to do so, we will be importing the time library. In Python, we need to import a library to make use of it. Since we interfaced the LED to the GPIO pin 2, let's make a mention of that in our code:
import time led = LED(2)
We just ...
Read now
Unlock full access