Raspberry pi GPIO control : LED blinking

Raspberry pi GPIO control : LED blinking

Project Description

beginners of raspberry pi 1st code in python

Project Facts

  • Category : Electronics
  • Skill : Basic
  • Build by Alex Jolly
  • 430 Hits

 

Demo project on LED Blinking in Pi

Source code

import RPi.GPIO as gpio 
import os
import time
gpio.setmode(gpio.BCM)
gpio.setwarnings(False)
gpio.setup(17,gpio.OUT) #LED connected to GPIO 17 of RPi

while 1:
     gpio.output(17,gpio.HIGH) #LED on
     time.sleep(1) #delay of 1sec
     gpio.output(17,gpio.LOW) #LED off
     time.sleep(1) #delay of 1sec

gpio.clear()