Raspberry Pi Start Here

So you've got your Raspberry Pi, maybe as a Christmas present, and you've followed the Quick Start Guide. You've got a black screen with confusing white text, and you've managed to "login", whatever that means. What do you do now?

Probably, before you've got comfortable with the "command-line" environment, you'll want to start the windows environment every time. Just type "startx" and hit Enter.

screenshot1.png

You will get something that looks like this:

screenshot2.png

It looks a bit different, but it works just the same as Microsoft Windows: the Start button is that odd-shaped thing in the bottom left-hand corner, or you can double-click the icons to start them.

Browsing the Internet

For a start, lets try browsing the Internet. Hit the Start button and a menu opens up. Move your mouse to "Internet" and another menu opens beside it. Move over to "Midori" and click it. The menus go away and after a few seconds the web-browser appears:

screenshot3.png

The address bar (the bit at the top that reads "file:///usr…") and the search bar (the bit that reads "Duck Duck Go") work just the same as you are used to. Go ahead and search for a nice picture for your desktop. I'm having this one:
7889550876_473ffa0d87_s.jpg
(click to enlarge)

Right-click the picture and choose "Save Image". A Save File dialog pops up, and it is probably unlike anything you have seen before:

screenshot4.png

At the top of the dialog is the name of the file. Feel free to change that to something meaningful. On the left is a selection of useful places you might want to save the file. We will save it to our home directory which is called "pi" (remember from when you logged in, pi is our username). We could create a sub-folder for it or put it in one of the existing folders by selecting them in the right-hand panel, just like in Windows. So for now, make sure "pi" is selected on the left, change the name if you want, and hit the "Save" button.

We've got our picture, so you can close Midori now.

Changing the desktop image

We've got a pretty picture, so now we need something to do with it.

  • Right click anywhere on the desktop background.
  • Select Desktop Preferences
screenshot5.png

We want to change the wallpaper, so click on the bit that says "desktop-background" (that's the file that is currently being used.)

screenshot6.png

Here's that file dialog again. This is an open dialog rather than a Save dialog, so there is no name on the top, just a list of folders. You can see that we are not in any of the usual places from the left-hand bar. Instead we are in a particularly obscure folder. That's just because that is where the picture of the raspberry is stored. All we need to do is to hit the "pi" in the left-hand pane to go back to the home directory, and then double click the picture you want to use.

Immediately the screen background changes. You may want to change the "Wallpaper mode" to "Stretch to fill the entire screen", or you may want to change the background colour to suit. I'm sure you can cope; just play around if you are uncertain. The colour dialog is particularly strange if you haven't seen anything like it before.

When you're happy just hit "Close".

Our First Program

If you want to program in Scratch, the icon is there on the desktop. Pick up a copy of the MagPi and have a go. For this introduction I'll be using Python, which is just a bit more fiddly.

Double click on the IDLE icon. I'll be using Python version 2 here. The other IDLE 3 icon uses Python version 3. Feel free to wonder why they're both there. (There is a good reason, honest.)

You've got the Python Shell window open and it is sitting there with a ">>>" prompt waiting for you to type something.

Just to keep it happy, type "5+3" and hit Enter.

>>> 5+3
8
>>>

Python does sums!

It is possible to do a fair amount in the Shell window, but to write programs that you can run more than once, we will need to create a file with them in.

Go to the "File" menu and click on "New Window". Now we've got another window called "Untitled". We'll fix that when we save the file. Type the following simple program into the new window:

print "What is your name?",
name = raw_input()
print "Hello", name

The colours will be different. This website recognises Python language, and so does IDLE, but they colour things differently.

Save the file by going to the File menu and selecting Save. Save it in your home directory and call it "hello.py".

screenshot7.png

Now isn't that helpful? Just when you've got used to one file dialog, another comes along. There's reasons for that, but I didn't do it, so don't blame me. Anyway this one looks more like the file dialog in Windows, and your home directory is already selected. So all you need to do is type "hello.py" and hit "Save".

Finally we can run our program. On the "Run" menu, select "Run Module". Then look down at the Python Shell window:

>>> =============================== RESTART ==========================
>>>
What is your name?

Go ahead and type your name in the Python Shell window and hit Enter
>>> =============================== RESTART ==========================
>>>
What is your name? Richard
Hello Richard

And there it is: your very first Python program. If you got some strange "Traceback" error message, don't worry; so did I (I called the "raw_input" function "rawinput" at first). Just check very carefully that the program is exactly the same as it appears above, down to the smallest coma.

What now?

Now you know how to run Python programs on the Raspberry Pi, you can go through an online tutorial that will teach you how to write programs. There are several here.

One More Thing

A quick warning before you go.

With Microsoft Windows you are probably used to typing things in UPPER-CASE sometimes and lower-case at other times, and now and again All hIggLdy-PigldY just for fun.

Well you've got to stop. Linux does not ignore the case of the characters you type. It takes very careful note.

For instance you can have a file called "hello.py" and another called "Hello.py", and a third called "hello.PY", and they are all different files with different contents.

There are five stages to this knowledge:

  1. Think "That's horrible"
  2. Think "That's a neat trick"
  3. Have several files that have the same names but with different cases.
  4. Loose something important
  5. Decide to use only lower-case names.

Consider yourself warned.


Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License