Created
September 27, 2020 05:30
-
-
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/
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
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