Created
October 1, 2020 15:27
-
-
Save jaggedprospect/67c38012d361e5ac7de8c79898c94f08 to your computer and use it in GitHub Desktop.
A program written in Python to control an LED light from a Raspberry Pi.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# blinking_led.py | |
# @author Nate Heppard | |
# @date 1 October 2020 | |
import RPi.GPIO as GPIO # Import RasPi GPIO library | |
from time import sleep # Import sleep function from time module | |
LED_PIN = 23 # Pin used to control LED | |
GPIO.setwarnings(False) # Ignore GPIO warnings | |
GPIO.setmode(GPIO.BCM) # Use BCM GPIO pin numbering | |
GPIO.setup(LED_PIN, GPIO.OUT, initial=GPIO.LOW) # Set LED_PIN to be an output pin, set initial value to low (off) | |
# Run the loop forever | |
while True: | |
GPIO.output(LED_PIN, GPIO.HIGH) # Set LED_PIN to high (on) | |
sleep(1) # Sleep for 1 second | |
GPIO.output(LED_PIN, GPIO.LOW) # Set LED_PIN to low (off) | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment