PROGRAMMING RPI GPIO PINS

RPi.GPIO 0.6.3

  • A module to control Raspberry Pi GPIO channels 
  • This package provides a class to control the GPIO on a Raspberry Pi. 
  •  It is recommended that you install RPi.GPIO using the pip utility as superuser (root): 
  •  Sudo pip install RPi.GPIO

Importing the module

  • To import the RPi.GPIO module: 
  •  import RPi.GPIO as GPIO 
  •  By doing it this way, you can refer to it as just GPIO through the rest of your script. 
  • Check the version of RPi.GPIO 
  • GPIO.VERSION

Pin numbering

  • There are two ways of numbering the IO pins on a Raspberry Pi within RPi.GPIO. 
  • BOARD numbering: This refers to the pin numbers on the P1 header of the Raspberry Pi board. 
  •  BCM numbering: it refers to the channel numbers on the Broadcom SOC. 
  • To specify which you are using using (mandatory):
  • GPIO.setmode(GPIO.BOARD) 
  •  GPIO.setmode(GPIO.BCM) 
  • mode = GPIO.getmode()



Downloads