0
0
Raspberry Piprogramming~5 mins

Digital output (GPIO.output) in Raspberry Pi - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does GPIO.output(pin, state) do in Raspberry Pi programming?
It sets the electrical state of a specific pin on the Raspberry Pi to either HIGH (on) or LOW (off), controlling devices like LEDs or motors.
Click to reveal answer
beginner
What are the two possible states you can set with GPIO.output()?
The two states are GPIO.HIGH (or 1) to turn the pin on, and GPIO.LOW (or 0) to turn the pin off.
Click to reveal answer
beginner
Why do you need to set the pin mode to GPIO.OUT before using GPIO.output()?
Because the pin must be configured as an output pin to send signals out. If it’s not set to output, you can’t control devices connected to it.
Click to reveal answer
beginner
What Python library is commonly used to control GPIO pins on a Raspberry Pi?
The RPi.GPIO library is commonly used to control GPIO pins in Python on a Raspberry Pi.
Click to reveal answer
beginner
How do you clean up GPIO settings after your program finishes?
You call GPIO.cleanup() to reset all GPIO pins to their default state, preventing conflicts in future programs.
Click to reveal answer
What does GPIO.output(18, GPIO.HIGH) do?
ATurns pin 18 on
BTurns pin 18 off
CSets pin 18 as input
DCleans up GPIO pins
Before using GPIO.output(), what must you do?
ACall GPIO.cleanup()
BSet the pin mode to GPIO.OUT
CSet the pin mode to GPIO.IN
DImport time module
Which library is used to control GPIO pins in Python on Raspberry Pi?
Anumpy
Bmatplotlib
CRPi.GPIO
Dpandas
What does GPIO.LOW mean when used with GPIO.output()?
AReset all pins
BTurn the pin on
CSet pin as input
DTurn the pin off
Why should you call GPIO.cleanup() at the end of your program?
ATo reset pins and avoid conflicts
BTo turn all pins on
CTo speed up the program
DTo import GPIO library
Explain how to turn an LED on and off using GPIO.output() on a Raspberry Pi.
Think about setting the pin as output first, then controlling the voltage.
You got /4 concepts.
    Describe why it is important to call GPIO.cleanup() after controlling GPIO pins.
    Consider what happens if pins stay set after your program ends.
    You got /4 concepts.