Book Image

Python Programming with Raspberry Pi

By : Sai Yamanoor, Srihari Yamanoor
Book Image

Python Programming with Raspberry Pi

By: Sai Yamanoor, Srihari Yamanoor

Overview of this book

Raspberry Pi Zero is a super-small and super-affordable product from Raspberry Pi that is packed with a plethora of features and has grabbed the notice of programmers, especially those who use Python. This step-by-step guide will get you developing practical applications in Python using a Raspberry Pi Zero. It will become a valuable resource as you learn the essential details of interfacing sensors and actuators to a Raspberry Pi, as well as acquiring and displaying data. You will get started by writing a Python program that blinks an LED at 1-second intervals. Then you will learn to write simple logic to execute tasks based upon sensor data (for example, to control a motor) and retrieve data from the web (such as to check e-mails to provide a visual alert). Finally, you will learn to build a home automation system with Python where different appliances are controlled using the Raspberry Pi. The examples discussed in each chapter of this book culminate in a project that help improve the quality of people’s lives.
Table of Contents (17 chapters)
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Let's learn Python!


Python is a high-level programming language invented by Guido Van Rossum. It is advantageous to learn Python using the Raspberry Pi for the following reasons:

  • It has a very simple syntax and hence is very easy to understand.
  • It offers the flexibility of implementing ideas as a sequence of scripts. This is helpful to hobbyists to implement their ideas.
  • There are Python libraries for the Raspberry Pi's GPIO. This enables easy interfacing of sensors/appliances with the Raspberry Pi.
  • Python is used in a wide range of applications by technology giants such as Google. These applications range from simple robots to personal AI assistance and control modules in space.
  • The Raspberry Pi has a growing fan base. This combined with the vast user base of Python means that there is no scarcity of learning resources or support for projects.

In this book, we will learn Python version 3.x. We will learn each major aspect of Python programming using a demonstrative example. Find out the awesomeness of Python by learning to do things by yourself! Keep in mind that there is Python 2.x, and it has subtle differences from Python 3.x.

Note

If you are comfortable with the Linux command-line terminal, we recommend setting up your Raspberry Pi for remote development, as shown in Chapter 11, Tips and Tricks.