0
0
Raspberry Piprogramming~5 mins

First GPIO program (LED blink) in Raspberry Pi - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is GPIO on a Raspberry Pi?
GPIO stands for General Purpose Input/Output. It is a set of pins on the Raspberry Pi that can be programmed to control electronic components like LEDs or read sensors.
Click to reveal answer
beginner
Why do we need to set the GPIO pin mode before using it?
Setting the GPIO pin mode tells the Raspberry Pi if the pin will be used to send signals (output) or receive signals (input). For blinking an LED, we set it as output.
Click to reveal answer
beginner
What does the following Python code do? <br>
GPIO.output(18, GPIO.HIGH)
This code turns on the device connected to GPIO pin 18 by sending a HIGH signal (3.3V), which can light up an LED.
Click to reveal answer
beginner
Why do we use a delay (like time.sleep) in an LED blink program?
The delay pauses the program so the LED stays on or off long enough for us to see the blinking effect clearly.
Click to reveal answer
beginner
What is the purpose of cleaning up GPIO pins at the end of a program?
Cleaning up resets the GPIO pins to a safe state, preventing unexpected behavior or damage when the program finishes.
Click to reveal answer
Which GPIO pin mode should you set to blink an LED?
AAnalog
BInput
CPWM
DOutput
What does GPIO.HIGH mean in a Raspberry Pi program?
APin is disconnected
BPin is off
CPin is on (3.3V)
DPin is set to input
Why do we use time.sleep() in an LED blink program?
ATo speed up the blinking
BTo pause so the LED stays on/off visibly
CTo reset the GPIO pins
DTo read input from the LED
What Python library is commonly used to control GPIO pins on Raspberry Pi?
ARPi.GPIO
Bnumpy
Cmatplotlib
Dpandas
What should you do at the end of a GPIO program to avoid issues?
ACall GPIO.cleanup()
BDisconnect the power
CRestart the Raspberry Pi
DLeave pins as they are
Explain step-by-step how to write a simple program to blink an LED using Raspberry Pi GPIO pins.
Think about what you need to do to make the LED turn on and off repeatedly.
You got /9 concepts.
    Why is it important to use GPIO.cleanup() in your Raspberry Pi GPIO programs?
    Consider what happens if pins stay set after your program ends.
    You got /4 concepts.