commit 38e093a403c5151b55c6b7c5e21d342f22510cf9 Author: Luna Date: Thu Mar 26 19:03:19 2026 +0100 Standalone LED flash script diff --git a/README.md b/README.md new file mode 100644 index 0000000..f840099 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Flash-LED +Standalone Python script to flash an LED on GPIO 17 of a Raspberry Pi. + +## Usage +`python3 flash_led.py` + +Requires `RPi.GPIO` to be installed on the host. diff --git a/flash_led.py b/flash_led.py new file mode 100644 index 0000000..f29156f --- /dev/null +++ b/flash_led.py @@ -0,0 +1,19 @@ +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.")