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:
We build the circuit and program the Banana Pi afterwards.