The Raspberry Pi has special parts that let you connect to other devices and screens. These parts help you control things and see what your Pi is doing.
0
0
Raspberry Pi hardware overview (GPIO, USB, HDMI)
Introduction
When you want to connect buttons or sensors to your Raspberry Pi.
When you need to plug in a keyboard, mouse, or USB drive.
When you want to connect your Raspberry Pi to a monitor or TV screen.
When you are building a project that needs to interact with the outside world.
When you want to watch videos or display images using your Raspberry Pi.
Syntax
Raspberry Pi
GPIO pins: Physical pins on the Raspberry Pi to connect electronic components. USB ports: Slots to plug in USB devices like keyboards or flash drives. HDMI port: A port to connect your Raspberry Pi to a screen or TV.
GPIO pins are numbered and can be used for input (reading signals) or output (sending signals).
USB ports support many devices and provide power and data connection.
Examples
These examples show how each hardware part can be used in simple ways.
Raspberry Pi
GPIO pin 17: Can be used to turn on an LED light. USB port 1: Plug in a keyboard. HDMI port: Connect to a monitor to see the desktop.
These examples show common uses for each hardware interface.
Raspberry Pi
GPIO pins can read a button press. USB ports can connect a Wi-Fi adapter. HDMI port can display video output.
Sample Program
This program uses the GPIO pins to turn on an LED light for 3 seconds, then turns it off. It shows how to control hardware with code.
Raspberry Pi
# This program turns on an LED connected to GPIO pin 17 import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) print('LED on for 3 seconds') GPIO.output(17, GPIO.HIGH) time.sleep(3) GPIO.output(17, GPIO.LOW) print('LED off') GPIO.cleanup()
OutputSuccess
Important Notes
Always be careful with GPIO pins to avoid short circuits.
USB ports can power devices but check power limits to avoid damage.
HDMI cables carry both video and sound to your screen.
Summary
GPIO pins let you connect and control electronic parts.
USB ports connect keyboards, mice, and storage devices.
HDMI port connects your Raspberry Pi to a screen for display.