import RPi.GPIO as GPIO # Using GPIO is more common than just GPIO
import time
# Set pin numbering mode (BCM or BOARD) based on your preference
GPIO.setmode(GPIO.BCM)
# Define LED pin
led_pin = 17
# Set up LED pin as output
GPIO.setup(led_pin, GPIO.OUT)
try:
print("Press Ctrl+C to stop blinking")
while True:
GPIO.output(led_pin, GPIO.HIGH)
time.sleep(1)
GPIO.output(led_pin, GPIO.LOW)
time.sleep(1)
# Clean up GPIO on exit
except KeyboardInterrupt:
print("Cleaning up GPIO...")
GPIO.cleanup()