HOME
> Components
> Raspberry Pi: Control Gpio Pins - This Is How It's Easy
Raspberry Pi: Control GPIO pins - this is how it's easy
The newer Raspberry Pis have a 40-head pin header on which there are so-called input-output pins (GPIO). You can control these GPIOs with your smartphone, for example, and thus control various things in your household.
How are the GPIOs controlled?
Every Raspberry Pi nowadays has input-output pins (GPIOs). These can be controlled with a program or app to control other devices or LEDS.- For the setup you need a Raspberry Pi, a small LED, a 330 Ohm resistor and 4 Male to Male jumper cables.
- The LED has a longer end. Plug this end into the breadboard in the right direction.
- Now plug the jumper cable into a hole under the longer LED connector and connect the other side to GPIO 23 on your Raspberry Pi.
- Now plug a 330 ohm resistor under the other side of the LED and plug the other end further left into the breadboard. Attach a jumper cable underneath the resistor plugged in on the left and connect it to ground on your Raspberry Pi.
- Open the Python console on your PC and type "import RPi.GPIO as GPIO", "import time". Furthermore, enter the command "GPIO.setmode(GPIO.BCM)".
- Now define GPIO 23 as output. „GPIO.setup(23, GPIO.OUT)“.
- Nun können Sie die LED mit folgenden Befehlen an- beziehungsweise ausschalten: „GPIO.output(23, GPIO.HIGH)“, „GPIO.output(23, GPIO.LOW).