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?✗ Incorrect
Setting pin 18 to GPIO.HIGH turns it on, sending voltage out.
Before using
GPIO.output(), what must you do?✗ Incorrect
Pins must be set as output with GPIO.OUT to send signals.
Which library is used to control GPIO pins in Python on Raspberry Pi?
✗ Incorrect
RPi.GPIO is the standard library for GPIO control on Raspberry Pi.
What does
GPIO.LOW mean when used with GPIO.output()?✗ Incorrect
GPIO.LOW sets the pin voltage to 0, turning it off.
Why should you call
GPIO.cleanup() at the end of your program?✗ Incorrect
Cleaning up resets pins to safe states for future use.
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.