CONTENTS

Preface

Acknowledgments

Introduction

1 Introduction

What Is the Raspberry Pi?

What Can You Do with a Raspberry Pi?

A Tour of the Raspberry Pi

Setting Up Your Raspberry Pi

Buying What You Need

Connecting Everything Together

Booting Up

Summary

2 Getting Started

Linux

The Desktop

The Internet

The Command Line

Navigating with the Terminal

sudo

Applications

Internet Resources

Summary

3 Python Basics

IDLE

Python Versions

Python Shell

Editor

Numbers

Variables

For Loops

Simulating Dice

If

Comparisons

Being Logical

Else

While

Summary

4 Strings, Lists, and Dictionaries

String Theory

Lists

Functions

Hangman

Dictionaries

Tuples

Multiple Assignment

Multiple Return Values

Exceptions

Summary of Functions

Numbers

Strings

Lists

Dictionaries

Type Conversions

Summary

5 Modules, Classes, and Methods

Modules

Using Modules

Useful Python Libraries

Object Orientation

Defining Classes

Inheritance

Summary

6 Files and the Internet

Files

Reading Files

Reading Big Files

Writing Files

The File System

Pickling

Internet

Summary

7 Graphical User Interfaces

Tkinter

Hello World

Temperature Converter

Other GUI Widgets

Checkbutton

Listbox

Spinbox

Layouts

Scrollbar

Dialogs

Color Chooser

File Chooser

Menus

The Canvas

Summary

8 Games Programming

What Is Pygame?

Coordinates

Hello Pygame

A Raspberry Game

Following the Mouse

One Raspberry

Catch Detection and Scoring

Timing

Lots of Raspberries

Summary

9 Interfacing Hardware

GPIO Pin Connections

Pin Functions

Serial Interface Pins

Power Pins

Hat Pins

Breadboarding with Jumper Wires

Digital Outputs

Step 1. Put the Resistor on the Breadboard

Step 2. Put the LED on the Breadboard

Step 3. Connect the Breadboard to the GPIO Pins

Analog Outputs

Digital Inputs

Analog Inputs

Hardware

The Software

Breadboarding with the Pi Cobbler

Prototyping Boards

Perma-Proto

Perma-Proto Pi HAT

Other Boards and HATs

Arduino and the Pi

Arduino and Pi Talk

Summary

10 LED Fader Project

What You Need

Hardware Assembly

Software

Summary

11 Prototyping Project (Clock)

What You Need

Hardware Assembly

Software

Phase Two

Summary

12 Raspberry Pi Robot

What You Need

Project 1. Autonomous Rover

Hardware

Software

Project 2. Web-Controlled Rover

Software

Summary

13 What Next

Linux Resources

Python Resources

Raspberry Pi Resources

Other Programming Languages

Scratch

C

Applications and Projects

Media Center (Raspbmc)

Home Automation

Summary

Index