The Raspberry Pi 2A is a compact, single-board computer designed for educational purposes, hobbyists, and for use in various embedded projects. It is a cost-effective solution for those looking to learn programming, build simple embedded systems, or experiment with electronics. The Raspberry Pi 2A is known for its ease of use and versatility, making it a popular choice for a wide range of applications, from simple educational projects to more complex electronic designs.
Pin Number | Description | Pin Number | Description |
---|---|---|---|
1 | 3.3V Power | 2 | 5V Power |
3 | GPIO 2 (SDA1, I2C) | 4 | 5V Power |
5 | GPIO 3 (SCL1, I2C) | 6 | Ground |
... | ... | ... | ... |
39 | Ground | 40 | GPIO 21 (SPI0_MISO) |
Note: This table is not exhaustive. Refer to the Raspberry Pi GPIO documentation for the complete pinout.
Here is a simple Python script to blink an LED connected to the GPIO pin 21 on the Raspberry Pi 2A. This assumes you have the RPi.GPIO library installed.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM) # Use Broadcom pin numbering GPIO.setup(21, GPIO.OUT) # Set GPIO pin 21 to output mode
try: while True: GPIO.output(21, GPIO.HIGH) # Turn on the LED time.sleep(1) # Wait for one second GPIO.output(21, GPIO.LOW) # Turn off the LED time.sleep(1) # Wait for one second except KeyboardInterrupt: GPIO.cleanup() # Clean up GPIO on CTRL+C exit
GPIO.cleanup() # Clean up GPIO on normal exit
*Note: This code is for demonstration purposes and assumes that the user has basic knowledge of setting up the Raspberry Pi and running Python scripts.*
Remember to always check the Raspberry Pi's GPIO pinout and ensure you're connecting the LED to the correct pin with a suitable resistor to limit the current.