17 lines
387 B
Python
17 lines
387 B
Python
import RPi.GPIO as GPIO
|
|
import time
|
|
|
|
LED_PIN = 17 # GPIO phisical pin
|
|
|
|
GPIO.setmode(GPIO.BCM)
|
|
GPIO.setup(LED_PIN, GPIO.OUT)
|
|
|
|
# Alternate every second, turning an LED on and off. Stopped by CTRL+C
|
|
try:
|
|
while True:
|
|
GPIO.output(LED_PIN, GPIO.HIGH)
|
|
time.sleep(1)
|
|
GPIO.output(LED_PIN, GPIO.LOW)
|
|
time.sleep(1)
|
|
except KeyboardInterrupt:
|
|
GPIO.cleanup() |