Zeroohm
Posts: 1
Joined: Sun Apr 23, 2017 8:05 am

Zeroohm's Beginners Guide on Raspberry Pi

Sun Apr 23, 2017 8:17 am

Welcome to Zeroohm Raspberry Pi Tutorial. Zeroohm will focus its efforts on helping the community learn more about Raspberry Pi fundamentals and basics starting with basic control of LED's, motors, sensors and utilizing of wireless communication. We hope that you find this useful, Please, leave a comment for any questions or comments or reviews!

To use raspberry pi’s GPIO pins in python you must first download the ‘RPi.GPIO’ library. To do so, open the terminal in the raspberry pi and run the following command:

Code: Select all

sudo apt-get update
After it’s done, run:

Code: Select all

sudo apt-get install rpi.gpio
To access the GPIO pins in python you must first import the ‘RPi.GPIO’ library to the code:
RPi.GPIO as GPIO

Then we must the mode of the pins. In this you have two options, the first mode is ‘BOARD’ mode where use the physical numbering of the pins (you can simply count with your finger!!). The second mode is the ‘BCM’ mode, when use this mode you need to follow the number after ‘GPIO’ in the figure below:
Image
To set the mode to ‘BOARD’ we use:

Code: Select all

GPIO.setmode(GPIO.BOARD)
To set the mode to ‘BCM’ we use:

Code: Select all

GPIO.setmode(GPIO.BCM)
Then we set the pin that we want to use as input or output.

Code: Select all

GPIO.setup(pin,GPIO.IN)
GPIO.setup(pin,GPIO.OUT)
Where ‘pin’ is the number of the GPIO pin based on whether you used BOARD or BCM:

Ex: In BOARD pin number 3 is pin number 2 in BCM.

- See more at:
https://www.zeroohm.com/blog/introducti ... pberry-pi/

User avatar
DougieLawson
Posts: 35598
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Zeroohm's Beginners Guide on Raspberry Pi

Sun Apr 23, 2017 10:05 am

If you're going to post python code in the forum at least post it in [CODE]stuff goes here[/CODE] tags.

Also with all current versions of Raspbian Jessie (full version) RPi.GPIO is already installed for python3.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Zeroohm's Beginners Guide on Raspberry Pi

Sun Apr 23, 2017 10:47 am

ahm: simple commands like the very first:
Sudo apt-get update
not work

fruitoftheloom
Posts: 20198
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Zeroohm's Beginners Guide on Raspberry Pi

Sun Apr 23, 2017 10:54 am

Welcome, you appear to have not proof read or used TAGS to make your post understandable ;)
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12041
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Zeroohm's Beginners Guide on Raspberry Pi

Sun Apr 23, 2017 12:02 pm

KLL wrote:ahm: simple commands like the very first:
Sudo apt-get update
not work
try sudo apt-get update
as everything in Linux is case sensitive, so Sudo and sudo are not the same thing!

Corrected the original first post, and added code tags.

Return to “Beginners”