Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Gaming - Second Edition
Raspberry Pi Gaming - Second Edition

Raspberry Pi Gaming - Second Edition: Design, create, and play all kinds of video games on your Raspberry Pi computer

By Shea Silverman
€16.99 €10.99
Book Feb 2015 140 pages 1st Edition
eBook
€16.99 €10.99
Print
€20.99
Subscription
€14.99 Monthly
eBook
€16.99 €10.99
Print
€20.99
Subscription
€14.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Feb 20, 2015
Length 140 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781784399337
Vendor :
Raspberry Pi
Category :
Concepts :
Table of content icon View table of contents Preview book icon Preview Book

Raspberry Pi Gaming - Second Edition

Chapter 1. Getting Started with the Raspberry Pi

The Raspberry Pi is an inexpensive, feature-rich modern computer created by the Raspberry Pi Foundation. Since the release of the Model B in 2012, the community surrounding the computer has grown, allowing for an incredible amount of projects and software to be created for the device. These range from programming languages, educational applications, hardware prototypes, and of course, video games.

In this chapter, you will learn the following topics:

  • The different flavors of a Raspberry Pi

  • Setting up an SD card

  • Hooking up your Raspberry Pi

The different flavors of a Raspberry Pi


The Raspberry Pi Foundation has released four major models of the Raspberry Pi computer. They the are Model A, Model B, Model B+, and Model A+. The Raspberry Pi's CPU is the Broadcom BCM2835 chip. It contains an ARM processor running at 700 MHz and a powerful graphics chip. The board features HDMI and Composite (RCA) video outputs, USB ports, two expansion slots, a Micro USB port for power, and an array of GPIO (General-purpose input/output) pins to interact with the outside world.

Since all models share the same basic hardware platform, all the examples in this book are applicable to all the versions.

 

Model A

Model A+

Model B

Model B+

USB

1

1

2

4

Ethernet

0

0

1

1

Video outputs

HDMI/Composite

HDMI/Composite via 3.5 mm jack

HDMI/Composite

HDMI/Composite via 3.5 mm jack

Memory

256 MB

256 MB

512 MB

512 MB

Storage

SD card

MicroSD card

SD card

MicroSD card

Power usage

300 mA

300 mA

700 mA

600 mA

Price

$25

$20

$35

$35

Differences

Low cost solution. Does not have built in Ethernet and it has only one 1 USB port.

Newest board. Low power, low cost, and much smaller form factor.

Original board. Balances features and price.

New revision to the B board. Has a new layout, 4 USB ports, and more GPIO pins.

Setting up an SD card


The Raspberry Pi uses SD cards to contain its operating system and main storage space. A Raspberry Pi SD card contains two partitions, which are explained as follows:

  • The first one, is the boot partition. This space contains the Linux kernel, required boot up files, and most importantly, the config.txt file. This file allows you to change the boot time parameters and customize some of the functions of the Raspberry Pi. These options include over-clocking the device, changing monitor settings, and the memory split between CPU and GPU, among numerous other options.

  • The second partition contains a Linux partition, which holds all of your applications, configurations, and operating system files.

Preloaded SD card images are available, which make it quick and easy to get your Raspberry Pi up and running.

Choosing an SD card is an important step. There are many different combinations of card sizes and card speeds. 4 GB is the minimum size required for many of the operating systems (OS). I recommend that you start out with an 8 GB card. You will also see cards marked with Class 4, Class 6, and Class 10. This is the speed at which the card can be read and written to. I have found that the best bang for the buck is a Class 6 card, but don't worry too much about which one you choose.

Before we begin, you will need to download a suitable Raspberry Pi OS. We will be using the official operating system called Raspbian. You can download it from

http://www.raspberrypi.org/downloads.

Note

Warning! dd and Win32DiskImager can be used to overwrite your computer's own hard drive or other drives connected to your computer. Double and triple check that the drive you select is your SD card.

Creating the SD card in Windows

To create the SD card in Windows, you will need to download the program called Win32DiskImager by visiting http://sourceforge.net/projects/win32diskimager/.

Once you are done with the downloading, perform the following steps:

  1. Unzip the Raspbian image by double-clicking on the Raspbian.zip file.

  2. Select a place on your hard drive to save the extracted file.

  3. Click on Extract files….

  4. Insert the SD card into your computer's SD card reader.

  5. Run Win32 Disk Imager.

  6. Select the Raspberry Pi image on your hard drive.

  7. Select the drive letter under the device that corresponds to the SD card.

  8. Click on Write.

Creating the SD card in Macintosh OS X

OS X includes everything you need to create the SD card out of the box. We will use a utility called dd:

  1. Double-click the Raspbian image ZIP file. It will automatically extract into the same place as the ZIP file.

  2. Insert the SD card into your computer's SD card reader.

  3. Open the terminal application (located in the Applications | Utilities folder).

  4. Find the name of your SD card by typing diskutil list.

  5. Unmount your SD card by typing disktuil umountdisk <disk>, that is, /dev/disk2.

  6. Copy the OS image from your hard drive to the SD card by typing dd if=/path/to/os/image.img of=<disk> where <disk> is /dev/disk2, and path/to/os/image.img is the place to which you saved the image.

  7. It can take anywhere from 15 minutes to over an hour for the image to be written to the SD card. It will look like nothing is happening until it finishes copying. When it is done, you will see a message showing how long it took to transfer in seconds.

    Tip

    You can press Ctrl + T at any time to see the current status.

Creating the SD card in Linux

Like OS X, Linux includes everything you need out of the box:

  1. Insert the SD card into your computer's SD card reader.

  2. Using the terminal of your system, find the name of your SD card by typing sudo fdisk –l.

  3. If required, you can unmount your SD card by typing umount <disk> (which will be listed from the earlier command , IE/dev/disk2).

  4. Copy the OS image on your hard drive to the SD card by typing dd if=/path/to/os/image.img of=<disk>.

Now that you have created your Raspberry Pi SD card, it's time to set up our device!

Using NOOBS

The Raspberry Pi Foundation has created a piece of software called New Out Of the Box Software, often abbreviated as NOOBS. This is a small operating system, which is used to install other OSs onto your Raspberry Pi.

Installing NOOBS is much easier than other installs:

  1. Download NOOBS from http://www.raspberrypi.org/downloads and unzip the file.

  2. Insert the SD card into your computer's SD card reader.

  3. Drag and drop the NOOBS files onto the SD card and you are done!

At the first boot, you will be presented with a list of OSs available to be installed. Choose Raspbian and press Enter.

Hooking up your Raspberry Pi


It's very easy to properly set up a Raspberry Pi. If you can build a Lego set, you can build your Raspberry Pi computer. The following steps will help you in this:

  1. Place your SD card into the SD card slot on the underside of the Raspberry Pi.

  2. Connect the HDMI or RCA cable to the respective connector on the Raspberry Pi, and plug the other end into your monitor.

  3. Plug the Ethernet cable into the Ethernet jack (not applicable to Model A and A+) on the Raspberry Pi and the other end into your router or switch.

  4. Connect the USB mouse and keyboard to the two USB ports available on the Raspberry Pi. If you are using Model A, connect a USB hub to your Raspberry Pi and the mouse and keyboard to the hub.

  5. Plug the power supply's Micro USB connector into the Micro USB port on the Raspberry Pi to turn it on.

  6. A red LED, by the USB ports, will light up to indicate that the power is turned on.

  7. On your screen, a square rainbow image will appear for a brief moment, followed by some quick moving text or a graphic loading screen.

Congratulations! You have successfully booted up your Raspberry Pi!

Connecting to a Wi-Fi access point

The Raspberry Pi and Raspbian can easily connect to the Internet via Ethernet, but when using a USB wireless device, you can also connect to a Wi-Fi network. Raspbian includes a graphical utility to make connecting to a Wi-Fi access point easy. Go through the following steps:

  1. Boot up your Raspberry Pi.

  2. At the login screen, enter your username and password (default is pi and raspberry, respectively).

  3. In the command prompt, type startx to launch the desktop environment.

  4. Using your mouse, double-click on the WiFi Config icon that is on the desktop.

  5. The Wi-Fi configuration tool will appear shortly.

  6. Click on Scan to scan for available wireless networks around you.

  7. Double-click on the one you wish to connect to.

  8. If it is a secured network, you will be asked for a password.

  9. Enter the password and click on Add.

  10. The Status: Disconnected message should now change to Status: Completed.

  11. You are now connected to your wireless network.

    Note

    wpa_gui saves your connection information. If you logout or reboot your Raspberry Pi, it will automatically try to connect to a previously added access point.

    If you do not see wlan0 appear in the wpa_gui, or if your Raspberry Pi is unstable, you might need to use a powered USB hub. You should connect your device to a powered hub, and then connect the hub to the Raspberry Pi. This will ensure that the correct amount of power is received.

    You can also check whether your Wi-Fi adapter is supported by visiting http://elinux.org/RPi_USB_Wi-Fi_Adapters.

Summary


In this chapter, you learned how to create your Raspberry Pi's SD card, hook it up to your TV and other accessories, and connect it to the Internet. Now, it's time to have fun with the software on your Raspberry Pi.

In the next chapter, you will learn how to create your own video game using the Scratch programming language.

Left arrow icon Right arrow icon

Key benefits

What you will learn

Program games utilizing the Scratch language Install multiple operating systems Set up your Raspberry Pi computer Install and configure game system emulators Control your Minecraft world with the Python programming language Explore different kinds of joysticks, controllers, game pads, and other input devices Install applications in Linux

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Feb 20, 2015
Length 140 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781784399337
Vendor :
Raspberry Pi
Category :
Concepts :

Table of Contents

16 Chapters
Raspberry Pi Gaming Second Edition Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Getting Started with the Raspberry Pi Chevron down icon Chevron up icon
Scratch Chevron down icon Chevron up icon
Raspberry Pi Gaming Operating Systems Chevron down icon Chevron up icon
Emulators Chevron down icon Chevron up icon
Ported Games Chevron down icon Chevron up icon
Linux Games Chevron down icon Chevron up icon
Controllers Chevron down icon Chevron up icon
Troubleshooting Chevron down icon Chevron up icon
Games List Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.