In this series of lessons, we will be controlling the GPIO pins from Python. If you do not already have a Beaglebone Black Rev. C, you can pick one up HERE.
In this lesson we show you how to write and run a simple Python program. Be sure to go through LESSON 2, which shows you how to boot and remotely connect to the Beaglebone. You will need to know how to do that for this lesson.
In our earlier lessons we have taken you from installing the operating system, all the way through creating and running your first python program. At this point, you know how to generally operate the Raspberry Pi platform. Now we are ready to start building projects, and getting the Pi to perform for us. The first thing we will need to understand is which pins do what. The pi has many pins, so the diagram below shows what each pin can do.
In order to understand pin number, make sure to have your pi oriented as shown in the figure. Now look at the center two columns on the chart. These show you the physical pin number. The outer two columns of the chart show you the bcm numbering. Which numbering system you use depends on how you configure things in the software. We will cover this in the next lesson, but for now know there are two different numbering schemes. For the examples in this series of lessons we will use the bcm numbering scheme, so we will be using the number references in the outer two columns.
Also notice that some of the pins are multi-purpose. For example physical pins 3 and 5 can be GPIO pins, or they can be configured for I2C. Similarly, 8 and 10 can be general purpose GPIO pins, or can be Tx and Rx. Note the GPIO pins are analogous to your digital input/output pins on Arduino (the ones without the ~ by them).
In general when setting up a project I try and select GPIO pins that are not multi-function. In this way if I ever expand the project and want to add Tx/Rx or I2C capability, those pins are still free.
If you have been following these lessons by this time you should be fairly comfortable with the Linux operating system, and you should know enough commands to do what you need to from the terminal window and command line. We now want to move forward to actually start doing things with the Pi. In order to do this, we will be using the Python programming language.
In this lesson we look at changing file and folder permissions. In the earlier lessons we learned that we can view the file and folder permissions by navigating to the folder of interest, and then giving the ls -l command. In order to change the permissions, we will use the chmod command. This video explains how to use the chmod command to control who has what permissions.
In this lesson we get into the concepts of Linux permissions. We explore what can be done who whom to files and folders. In future lessons we will look at changing permissions, but in this video we just explain the concepts.
In LESSON 19 we showed how to add users to the Pi with limited permissions. In this lesson we show how to add a user with Admin privileges just like the default “Pi” user.
Fist you will want to log on as the default “pi” user. After logging on, you can add another user with the command:
$sudo adduser paul
once the user is added, you can then give them admin privileges like the pi user my modifying the account with the command:
$sudo usermod-a-Gadm,dialout,cdrom,sudo,audio,video,plugdev,games,users,netdev,input,indiecity paul
Now your user “paul” has the same admin privileges as “pi”. However if “paul” tries to execute a sudo command it will ask for his password. If you want “paul” to be able to execute sudo without entering password, you need to do the following:
NOTE: Messing up this file will corrupt your operating system. I suggest STRONGLY making a backup of your system before moving forward. Or, you could just leave things as they are, and “paul” will have to enter password when doing a sudo command
and then you will be nano-editing a file. Add the following to the last line of the file:
paul ALL=(ALL) NOPASSWD: ALL
Then Control o and enter to save the file, and then control x to exit.
Making The World a Better Place One High Tech Project at a Time. Enjoy!