Skip to main content

blinking a LED with raspberry pi

By:Prayag Nao

Today i am going to post how to blink a led with raspberry pi. Blinking a LED is a beginner task and simple task.

components required:
  • raspberry pi.
  • 2 Male to female connectors.
  • A 330 omh resistance.
  • A LED.


Here is pin diagram of Raspberry pi 2.

  1. Connect 11th pin to one end of resistance.
  2. connect ground pin to -ev pin of LED.
  3. Now connect remaining end of resistance to +ev of LED.
  4. Now turn on Raspberry pi.
  5. open text editor and paste following program into it.   
      import GPIO.RPi as GPIO            ##import GPIO library
      import time
      GPIO.setmode(GPIO.BOARD)    ##use board pin numbering
      GPIO.setup(11,GPIO.OUT)          ##set 11th pin as output pin

      while 1:
             GPIO.output(11,1)  ## Turn on led
             time.sleep(1)           ## 1 second delay
             GPIO.output(11,0)  ## Turn off led
             time.sleep(1)         
    
     6.Save above program as blink.py.
     7.Now run above program as root user and you will see blinking led.

Comments

Popular posts from this blog

How an engine cooling system works

By: Prayag nao



HOW INTERNAL EXPANDING BRAKE WORKS

By:Prayag nao


An internal expanding brake consists of two shoes S1 and S2. The outer surface of the shoes are lined with some friction material (usually with Ferodo) to increase the coefficient of friction and to prevent wearing away of the metal. Each shoe is pivoted at one end about a fixed fulcrum O1and O2 and made to contact a cam at the other end. When the cam rotates, the shoes are pushed outwards against the rim of the drum. The friction between the shoes and the drum produces the braking torque and hence reduces the speed of the drum. The shoes are normally held in
off position by a spring . The drum encloses the entire mechanism to keep out dust and moisture. This type of brake is commonly used in motor cars and light trucks.



We shall now consider the forces acting on such a brake, when the drum rotates in the anticlockwise direction. It may be noted that for the anticlockwise direction, the left hand shoe is known as leading or primary shoe while the right hand sho…

Awesome iris mechanism

By:Prayag nao



An iris is a mechanism that is used as a compact solution to close and open holes. It is made up of usually a series of metal plates that can fold in on each other or expand out. Iris mechanisms are commonly found in optical shutters (diaphragms). Irises are sometimes used in science fiction as doors.