Skip to content

Instantly share code, notes, and snippets.

@coderinboots
Created September 27, 2020 05:30
Show Gist options
  • Save coderinboots/526c64d84b07e1a50a7953d43c888b1e to your computer and use it in GitHub Desktop.
Save coderinboots/526c64d84b07e1a50a7953d43c888b1e to your computer and use it in GitHub Desktop.
Sample program to Turn ON and OFF LED in Raspberry Pi using python program. For more details visit https://www.coderinboots.com/
import RPi.GPIO as GPIO
from time import sleep
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(8,GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(10,GPIO.OUT, initial=GPIO.LOW)
while True:
GPIO.output(8,GPIO.HIGH) #Turn on GPIO pin 8 – changing LOW to HIGH
GPIO.output(10,GPIO.LOW) #Turn off GPIO pin 10 – changing HIGH to LOW
sleep(1.00) # 1 second gap, in-order to see the blinking
GPIO.output(8,GPIO.LOW) #Turn off GPIO pin 8 – changing HIGH to LOW
GPIO.output(10,GPIO.HIGH) #Turn on GPIO pin 10 – changing LOW to HIGH
sleep(1.00) # 1 second gap, in-order to see the blinking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment