Recall & Review
beginner
What does
GPIO.input(pin) do in Raspberry Pi programming?It reads the current digital value (HIGH or LOW) from the specified GPIO pin, telling you if the pin is receiving voltage or not.
Click to reveal answer
beginner
Why do you need to set up a GPIO pin as input before using
GPIO.input()?Because the Raspberry Pi needs to know if the pin is used to read signals (input) or send signals (output). Setting it as input prepares it to detect voltage changes.
Click to reveal answer
beginner
What are the possible return values of
GPIO.input(pin)?It returns either
GPIO.HIGH (or 1) if voltage is detected, or GPIO.LOW (or 0) if no voltage is detected.Click to reveal answer
intermediate
How can you use
GPIO.input() to detect a button press?Connect the button to a GPIO pin set as input. When pressed, the pin reads HIGH or LOW depending on wiring. Use
GPIO.input(pin) to check if the button is pressed.Click to reveal answer
intermediate
What is a pull-up or pull-down resistor and why is it important when using
GPIO.input()?Pull-up or pull-down resistors keep the input pin at a known voltage level (HIGH or LOW) when no button is pressed, preventing random noise from causing false readings.
Click to reveal answer
What must you do before reading a pin with
GPIO.input(pin)?✗ Incorrect
You must set the pin as input first so the Raspberry Pi knows to read signals from it.
What does
GPIO.input(pin) return if the pin voltage is LOW?✗ Incorrect
It returns GPIO.LOW (or 0) when the pin voltage is low.
Why use a pull-down resistor with a button input?
✗ Incorrect
A pull-down resistor keeps the pin LOW when the button is not pressed, avoiding random signals.
If
GPIO.input(pin) returns 1, what does it mean?✗ Incorrect
A return value of 1 means the pin voltage is HIGH.
Which Python library is commonly used for GPIO input on Raspberry Pi?
✗ Incorrect
RPi.GPIO is the standard library for controlling GPIO pins on Raspberry Pi.
Explain how to read a button press using GPIO.input on a Raspberry Pi.
Think about wiring and reading the pin state.
You got /4 concepts.
Describe why pull-up or pull-down resistors are important when using digital inputs.
Imagine a wire not connected to anything.
You got /3 concepts.