Programming The Raspberry Pi™: Getting Started With Python, 3rd Edition PDF by Simon Monk

By

Programming The Raspberry Pi™: Getting Started With Python, Third Edition

By Simon Monk

Programming The Raspberry Pi™ Getting Started With Python, Third Edition

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 Command Line

Navigating with the Terminal

sudo

Applications

Internet Resources

Summary

3 Python Basics

Mu

Python Versions

Python Shell

Editor

Numbers

Variables

For Loops

Simulating Dice

If

Comparisons

Being Logical

Else

While

The Python Shell from the Terminal

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

JSON

Internet

Summary

7 Graphical User Interfaces

Guizero

Hello World

Temperature Converter

Other GUI Widgets

Pop-Ups

Menus

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

HATs

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

Set Up the Raspberry Pi Zero W

Web-Controlled Rover

What You Need

Hardware

Software

Autonomous Rover

What You Need

Hardware

Software

Summary

13 What Next

Linux Resources

Python Resources

Raspberry Pi Resources

Programming Languages

Scratch

C

Other Languages

Applications and Projects

Media Center (Kodi)

Home Automation

Summary

Index

PREFACE

The Raspberry Pi™ is rapidly becoming a worldwide phenomenon. People are waking up to the possibility of a $35 (U.S.) computer that can be put to use in all sorts of settings—from a desktop workstation to a media center to a controller for a home automation system.

This book explains in simple terms, to both nonprogrammers and programmers new to the Raspberry Pi, how to start writing programs for the Pi in the popular Python programming language. It then goes on to give you the basics of creating graphical user interfaces and simple games using the pygame module.

The software in the book uses Python 3, and the Mu editor. The Raspberry Pi OS distribution recommended by the Raspberry Pi Foundation is used throughout the book.

The book starts with an introduction to the Raspberry Pi and covers the topics of buying the necessary accessories and setting everything up. You then get an introduction to programming while you gradually work your way through the next few chapters. Concepts are illustrated with sample applications that will get you started programming your Raspberry Pi.

Four chapters are devoted to programming and using the Raspberry Pi’s GPIO connector, which allows the device to be attached to external electronics. These chapters include three sample projects—a LED lighting controller, a LED clock, and a Raspberry Pi–controlled robot, complete with ultrasonic rangefinder.

Here are the key topics covered in the book:

  • Python numbers, variables, and other basic concepts
  • Strings, lists, dictionaries, and other Python data structures
  • Modules and object orientation
  • Files and the Internet
  • Graphical user interfaces using guizero
  • Game programming using pygame
  • Interfacing with hardware via the GPIO connector
  • Sample hardware projects

All the code listings in the book are available for download from the books repository on Github at https://github.com/simonmonk/prog_pi_ed3, where you can also find other useful material relating to the book, including errata.

Simon Monk

This book is US$10. Order for this book:
(Request for free sample pages click on "Order Now" button)

Book Order
Or, Send email: [email protected]

Share this Book!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.