connect@howdiyworld.com
|

LED Blinking

BLOCK DIAGRAM

Procedure

  1. LED
  2. Connection
  3. Program
  4. Blinking LED

Procedure

How LED Works?

A LED or Light Emitting Diode is a Semiconductor
two terminal(Pin) component, the two terminals are (+)Positive and
(-)Negative. The voltage is applied to positive terminal and negative terminal
should be ground light is emitted. Here we are using 12V LED so the maximum
Voltage for positive terminal is 12V and minimum is 3V. If we use anything
above 12V the LED will get short circuit.

Script to Control GPIO

  • Connect the positive Pin(The one which is longer) to the 29th pin on the breadboard
  • Then connect the negative pin to 34th Pin on the breadboard.

Take It a Step Further

import RPi.GPIO as GPIO # Include the Header file and rename as whatever you want

import time #Include Header file Library for time

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD) #setmode BCM or BOARD

GPIO.setup(29,GPIO.OUT) #setup the pin Input or Output

def get_input(a): #get a number

GPIO.output(29,True) #here 29th output pin will be High(True)

time.sleep(a) #delaying ON time what you give

GPIO.output(29,False) # here 29th pin output will be Low(False)

time.sleep(a) #delaying Off time

Blinking LED

        Now let’s run the code!

        Here you can set the time interval between Each Blink. So let’s set this to 5.

       Now you can see the LED is blinking with the interval of 5 seconds, you can change the number to how much ever you want.

Social media & sharing icons powered by UltimatelySocial
Facebook
Twitter
YouTube
LinkedIn
Instagram