Data Sheet

ADVENTURES IN RASPBERRY PIBC12
Bonus chapter.indd 12 Trim size: 7.375 in × 9.1875 in October 24, 2017 7:20 PM
GPIO Pins Command Quick Reference Table
Command Description
from gpiozero import
LED, Button
Imports the Raspberry Pi gpiozero module
Led = LED(2)
Creates an LED against a pin number as well as identifying
it as an output
led.on()
Sets output GPIO to true or on
led.off()
Sets output GPIO to false or off
if button.is_pressed:
Sets a condition for a button press
if pir.motion_
detected:
Sets a condition for a PIR motion sensor
Achievement Unlocked: Conquering electronics with a Raspberry Pi!
Chapter 8