Skip to main content

Posts

Showing posts from September, 2015

Simple GPIO input/output program for raspberry pi

By: prayag nao

Today we are going to discuss about simple I/O program of raspberry pi.here is pin diagram of raspberry.



so we are going to talk about GPIO I/O program then we need 2 pins,one for output and one for input from button.

material required:
Raspberry pi.A push Button.some connector wires.A LED. connections:
connect 5v pin of raspberry pi to one pin of push button.Now connect one end of push button ti 11th pin of raspberry pi.Now connect 13th pin to +ev pin of led and ground to -ev pin of led (you should use a resistance of 330omhs in series with LED). Programming:

open text editor of raspberry pi and paste the following code.       import GPIO.RPi as GPIO            ##import GPIO library
      import time
      GPIO.setmode(GPIO.BOARD)    ##use board pin numbering
      GPIO.setup(11,GPIO.IN)          ##set 11th pin as Input pin
      GPIO.setup(13,GPIO.OUT)       ## set 13th pin as output pin

      while 1:
        if GPIO.input(11):
             GPIO.output(13,1)  ## Turn on led
    …

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.

Connect 11th pin to one end of resistance.connect ground pin to -ev pin of LED.Now connect remaining end of resistance to +ev of LED.Now turn on Raspberry pi.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.

Android USB Tethering to Connect a Raspberry Pi to the Internet...!

By: Prayag Nao

These days the easiest way to connect a PC or Raspberry Pi for that matter to the Internet via a smartphone is to use USB tethering.But in raspberry pi you can't do USB tethering directly,firstly you have to edit some information in raspberry pi.
so lets start........

turn on your raspberry pi.if you don't have a HDMI display then read my old post How to connect raspberry pi to laptop display Now go to terminal and type following command : sudo nano /etc/network/interfacesthat command will open network file.how edit network file,put these lines below line iface eth0 inet dhcpiface usb0 inet dhcp   5.Now save network file by pressing ctrl+o and press Enter.       6.Now exit from network file by pressing ctrl+x.  It's done now you can start USB tethering from your mobile device. 

How to connect raspberry pi to laptop display

By:Prayag Nao



The reason why I came up with this tutorial was because: one day, me along with my friends were struggling to work on the raspberry pi, since we did not have any HDMI/AV displays. Hence, I came up with this tutorial so that others who are also in the same situation as ours would be able to use the display of their laptops as a monitor to the Raspberry Pi.
As we know Raspberry Pi is known as the “Pocket Size PC”, but for debugging & project purposes its cumbersome to carry an additional display just for that. Also, many of us wont have access to a HDMI display too. So, we figured out a way to easily connect raspberry pi to laptop display. So sit back and enjoy this simple tutorial :)

These are the stuffs we need:Raspberry Pi.Ethernet Cable.Laptop.SD Card with Raspbian.Micro USB Cable. (Optional) Components required for setting it up the first time:
HDMI/ AV Display.Keyboard and MouseHow does it work? To connect raspberry pi to laptop display, you can simply u…