0%

An up-to-date guide to creating your own fun and useful Raspberry Pi™ programs

This fully updated guide shows how to create inventive programs and fun games on your powerful Raspberry Pi—with no programming experience required. Programming the Raspberry Pi™: Getting Started with Python, Third Edition addresses physical changes and new setup procedures as well as OS updates to the current version 4. You will discover how to configure hardware and software, write Python scripts, create user-friendly GUIs, and control external electronics. Step-by-step projects include a digital clock prototype and a fully functioning Raspberry Pi robot.

  • Configure your Raspberry Pi and explore its features
  • Start writing and debugging Python programs
  • Use strings, lists, functions, and dictionaries
  • Work with modules, classes, and methods
  • Apply object-oriented development methods
  • Create user-friendly games using Pygame
  • Build intuitive user interfaces with guizero
  • Interface with hardware using the gpiozero library
  • Attach external electronics through the GPIO port
  • Add powerful Web features to your projects

Table of Contents

  1. Cover
  2. About the Author
  3. Title Page
  4. Copyright Page
  5. Dedication
  6. Contents at a Glance
  7. Contents
  8. Preface
  9. Acknowledgments
  10. Introduction
  11. 1 Introduction
    1. What Is the Raspberry Pi?
    2. What Can You Do with a Raspberry Pi?
    3. A Tour of the Raspberry Pi
    4. Setting Up Your Raspberry Pi
    5. Buying What You Need
    6. Connecting Everything Together
    7. Booting Up
    8. Summary
  12. 2 Getting Started
    1. Linux
    2. The Desktop
    3. The Command Line
    4. Navigating with the Terminal
    5. sudo
    6. Applications
    7. Internet Resources
    8. Summary
  13. 3 Python Basics
    1. Mu
    2. Python Versions
    3. Python Shell
    4. Editor
    5. Numbers
    6. Variables
    7. For Loops
    8. Simulating Dice
    9. If
    10. Comparisons
    11. Being Logical
    12. Else
    13. While
    14. The Python Shell from the Terminal
    15. Summary
  14. 4 Strings, Lists, and Dictionaries
    1. String Theory
    2. Lists
    3. Functions
    4. Hangman
    5. Dictionaries
    6. Tuples
    7. Multiple Assignment
    8. Multiple Return Values
    9. Exceptions
    10. Summary of Functions
    11. Numbers
    12. Strings
    13. Lists
    14. Dictionaries
    15. Type Conversions
    16. Summary
  15. 5 Modules, Classes, and Methods
    1. Modules
    2. Using Modules
    3. Useful Python Libraries
    4. Object Orientation
    5. Defining Classes
    6. Inheritance
    7. Summary
  16. 6 Files and the Internet
    1. Files
    2. Reading Files
    3. Reading Big Files
    4. Writing Files
    5. The File System
    6. Pickling
    7. JSON
    8. Internet
    9. Summary
  17. 7 Graphical User Interfaces
    1. guizero
    2. Hello World
    3. Temperature Converter
    4. Other GUI Widgets
    5. Pop-Ups
    6. Menus
    7. Summary
  18. 8 Games Programming
    1. What Is Pygame?
    2. Coordinates
    3. Hello Pygame
    4. A Raspberry Game
    5. Following the Mouse
    6. One Raspberry
    7. Catch Detection and Scoring
    8. Timing
    9. Lots of Raspberries
    10. Summary
  19. 9 Interfacing Hardware
    1. GPIO Pin Connections
    2. Pin Functions
    3. Serial Interface Pins
    4. Power Pins
    5. Hat Pins
    6. Breadboarding with Jumper Wires
    7. Digital Outputs
    8. Step 1. Put the Resistor on the Breadboard
    9. Step 2. Put the LED on the Breadboard
    10. Step 3. Connect the Breadboard to the GPIO Pins
    11. Analog Outputs
    12. Digital Inputs
    13. Analog Inputs
    14. Hardware
    15. The Software
    16. HATs
    17. Summary
  20. 10 LED Fader Project
    1. What You Need
    2. Hardware Assembly
    3. Software
    4. Summary
  21. 11 Prototyping Project (Clock)
    1. What You Need
    2. Hardware Assembly
    3. Software
    4. Phase Two
    5. Summary
  22. 12 Raspberry Pi Robot
    1. Set Up the Raspberry Pi Zero W
    2. Web-Controlled Rover
    3. What You Need
    4. Hardware
    5. Software
    6. Autonomous Rover
    7. What You Need
    8. Hardware
    9. Software
    10. Summary
  23. 13 What Next
    1. Linux Resources
    2. Python Resources
    3. Raspberry Pi Resources
    4. Programming Languages
    5. Scratch
    6. C
    7. Other Languages
    8. Applications and Projects
    9. Media Center (Kodi)
    10. Home Automation
    11. Summary
  24. Index
18.207.98.249