We controlled the LED in the previous two recipes by the GPIO output mode. The next step is to use the GPIO pins as input pins. There is a basic electronic component to demonstrate the GPIO input mode easily—the pushbutton.
In this recipe, we are switching on an LED while a pushbutton is pressed. Once the pushbutton is released, the LED is switched off again.
The following ingredients are required for this recipe:
A Linux system on the Banana Pi
Access to the shell
A 5 mm LED (forward voltage 2.0 V)
A pushbutton
A 470 Ω resistor
A 10K Ω resistor
A breadboard
Four female to male jumper wires
One male to male jumper wire
We build the circuit and program the Banana Pi afterwards.