import RPi.GPIO as GPIO import time # Use GPIO 17 PIN = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(PIN, GPIO.OUT) try: print("Flashing LED for 10 seconds...") start_time = time.time() while time.time() - start_time < 5: GPIO.output(PIN, GPIO.HIGH) time.sleep(0.3) GPIO.output(PIN, GPIO.LOW) time.sleep(0.3) finally: GPIO.cleanup() print("Done.")