Understanding the Pi Proto Plate

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
MightyPooh
 
Posts: 1
Joined: Thu Dec 26, 2013 6:27 am

Understanding the Pi Proto Plate

Post by MightyPooh »

Hi there people of Adafruit.
Ive just bought your great piece of proto plate :).
Im all new to hardware programming and is about to start my first little button project with my kid.
The guides keep refering to GPIO pin numbers.
Ive read the manual from your site but i dont think i understand it.
On the plate theres alot of ports named #17 #4 and so forth. Does this refer to the pins? In the case that i want to something like this should i connect my button to #17?

Code: Select all

With your switch connected, let’s now look at how to read its state from Python. Start Python (as root so you can access the GPIO pins) with

sudo python

In your Python console:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)

This will import the necessary libraries in the GPIO namespace and set the pin numbering to correspond to your breakout board.

Now we need to set the pin as input, pin 17 is used in this example.

GPIO.setup(17,GPIO.IN)

Reading the pin is now as easy as:

input = GPIO.input(17)

If we want to print “Button Pressed” each time a button is pressed (and assuming we’ve set up the switch so the pin goes high when pressed):

while True:
  if (GPIO.input(17)):
    print("Button Pressed")

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Understanding the Pi Proto Plate

Post by adafruit_support_rick »

That's right. Those numbers are the GPIO numbers you use in your python code.
For reference, the pinout on the GPIO header is here. You can see that all the numbers/names match up
http://elinux.org/RPi_Low-level_periphe ... .28GPIO.29

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”