售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Raspberry Pi Cookbook for Python Programmers
Table of Contents
Raspberry Pi Cookbook for Python Programmers
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Safety and using electronics
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with a Raspberry Pi Computer
Introduction
Introducing the Raspberry Pi
What is with the name?
Why Python?
Python 2 and Python 3
Which version of Python should you use?
Connecting the Raspberry Pi
Getting ready
How to do it…
There's more…
Secondary hardware connections
Using NOOBS to set up your Raspberry Pi SD card
Getting ready
How to do it…
How it works…
There's more…
Changing the default user password
Ensuring that you shut down safely
Preparing an SD card manually
Expanding the system to fit in your SD card
Accessing the Data/RECOVERY/BOOT partition
Using the tools to backup your SD card in case of failure
Networking and connecting your Raspberry Pi to the Internet via the LAN connector
Getting ready
How to do it…
There's more…
Configuring your network manually
Getting ready
How to do it…
There's more…
Networking directly to a laptop or computer
Getting ready
How to do it…
How it works…
There's more…
Direct network link
See also
Networking and connecting your Raspberry Pi to the Internet via a USB Wi-Fi dongle
Getting ready
How to do it…
There's more…
Using USB wired network adapters
Connecting to the Internet through a proxy server
Getting ready
How to do it…
How it works…
There's more…
Connecting remotely to the Raspberry Pi over the network using VNC
Getting ready
How to do it…
There's more…
Connecting remotely to the Raspberry Pi over the network using SSH (and X11 Forwarding)
Getting ready
How to do it…
How it works…
There's more…
Running multiple programs with X11 Forwarding
Running as a desktop with X11 Forwarding
Running PyGame and Tkinter with X11 Forwarding
Sharing the home folder of the Raspberry Pi with SMB
Getting ready
How to do it…
Keeping the Raspberry Pi up to date
Getting ready
How to do it…
2. Starting with Python Strings, Files, and Menus
Introduction
Working with text and strings
Getting ready
How to do it…
How it works…
There's more…
Using files and handling errors
Getting ready
How to do it…
How it works…
Creating a boot-up menu
How to do it…
How it works…
There's more…
Creating a self-defining menu
How to do it…
How it works…
There's more…
Alternative script locations
Adding scripts to PATH
3. Using Python for Automation and Productivity
Introduction
Using Tkinter to create graphical user interfaces
Getting ready
How to do it…
How it works…
Creating a graphical application Start menu
Getting ready
How to do it…
How it works…
There's more…
Displaying photo information in an application
Getting ready
How to do it…
How it works…
There's more…
Organizing your photos automatically
Getting ready
How to do it…
How it works…
4. Creating Games and Graphics
Introduction
Using IDLE3 to debug your programs
How to do it…
How it works…
Drawing lines using a mouse on Tkinter Canvas
Getting ready
How to do it…
How it works…
Creating a bat and ball game
Getting ready
How to do it…
How it works…
Creating an overhead scrolling game
Getting ready
How to do it…
How it works…
5. Creating 3D Graphics
Introduction
Starting with 3D coordinates and vertices
Getting ready
How to do it…
How it works…
There's more…
Camera
Shaders
Lights
Textures
Creating and importing 3D models
Getting ready
How to do it…
How it works...
There's more…
Creating or loading your own objects
Changing the object's textures and .mtl files
Taking screenshots
Creating a 3D world to roam in
Getting ready
How to do it…
How it works…
Building 3D maps and mazes
Getting ready
How to do it…
How it works...
There's more...
The Building module
Using SolidObjects to detect collisions
6. Using Python to Drive Hardware
Introduction
Controlling an LED
Getting ready
How to do it…
How it works…
There's more…
Controlling the GPIO current
Responding to a button
Getting ready
How to do it…
How it works…
There's more…
Safe voltages
Pull-up and pull-down resistor circuits
Protection resistors
A controlled shutdown button
Getting ready
How to do it…
How it works…
There's more…
Resetting and rebooting Raspberry Pi
Adding extra functions
Relocating to the P5 header
The GPIO keypad input
Getting ready
How to do it…
How it works…
There's more…
Generating other key combinations
Emulating mouse events
Multiplexed color LEDs
Getting ready
How to do it…
How it works…
There's more…
Hardware multiplexing
Displaying random patterns
Mixing multiple colors
7. Sense and Display Real-world Data
Introduction
Using devices with the I2C bus
Getting ready
How to do it...
How it works...
There's more...
Using multiple I2C devices
I2C bus and level shifting
Using just the PCF8591 chip or adding alternative sensors
Reading analog data using an analog-to-digital converter
Getting ready
How to do it...
How it works...
There's more...
Gathering analog data without hardware
Logging and plotting data
Getting ready
How to do it...
How it works...
There's more...
Plotting live data
Scaling and calibrating data
Extending the Raspberry Pi GPIO with an I/O expander
Getting ready
How to do it...
How it works...
There's more…
I/O expander voltages and limits
Using your own I/O expander module
Directly controlling an LCD alphanumeric display
Sensing and sending data to online services
Getting ready
How to do it...
How it works...
See also
8. Creating Projects with the Raspberry Pi Camera Module
Introduction
Getting started with the Raspberry Pi camera module
Getting ready
How to do it…
How it works…
Using the camera with Python
Getting ready
How to do it…
How it works…
There's more…
Class member and static functions
Using a USB webcam instead
Additional drivers for the Raspberry Pi camera
See also
Generating a time-lapse video
Getting ready
How to do it…
How it works…
There's more…
Class inheritance and function overriding
Disabling the camera LED
Pi NoIR – taking night shots
Creating a stop frame animation
Getting ready
How to do it…
How it works…
There's more…
Improving the focus
Creating a hardware shutter
Making a QR code reader
Getting ready
How to do it…
How it works…
There's more…
Generating QR codes
See also
9. Building Robots
Introduction
Building a Rover-Pi robot with forward driving motors
Getting ready
How to do it…
How it works…
There's more…
Darlington array circuits
Transistor and relay circuits
Tethered or untethered robots
Rover kits
Using advanced motor control
Getting ready
How to do it…
How it works…
There's more…
Motor speed control using PWM control
Using I/O expanders
Building a six-legged Pi-Bug robot
Getting ready
How to do it…
How it works…
Controlling the servos
The servo class
Learning to walk
The Pi-Bug code for walking
Avoiding objects and obstacles
Getting ready
How to do it…
How it works…
There's more…
Ultrasonic reversing sensors
Getting a sense of direction
Getting ready
How to do it…
How it works…
There's more…
Calibrating the compass
Calculating the compass bearing
Saving the calibration
Driving the robot using the compass
10. Interfacing with Technology
Introduction
Automating your home with remote sockets
Getting ready
How to do it...
How it works...
There's more...
Sending RF control signals directly
Using SPI to control an LED matrix
Getting ready
How to do it…
How it works...
There's more...
Daisy-chain SPI configuration
Communicating using a serial interface
Getting ready
How to do it...
How it works...
There's more...
Configuring a USB to RS232 device for the Raspberry Pi
RS232 signals and connections
Using the GPIO built-in serial pins
The RS232 loopback
Controlling the Raspberry Pi over Bluetooth
Getting ready
How to do it...
How it works...
There's more...
Configuring Bluetooth module settings
Controlling USB devices
Getting ready
How to do it...
How it works...
There's more...
Controlling similar missile-type devices
Robot arm
Taking USB control further
A. Hardware and Software List
Introduction
General component sources
Hardware list
Software list
PC software utilities
Raspberry Pi packages
There's more...
APT commands
Pip Python package manager commands
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜