PDF Raspberry Pi Cookbook Software and Hardware Problems and Solutions 1st Edition Simon Monk download
PDF Raspberry Pi Cookbook Software and Hardware Problems and Solutions 1st Edition Simon Monk download
com
https://ebookname.com/product/raspberry-pi-cookbook-
software-and-hardware-problems-and-solutions-1st-edition-
simon-monk/
OR CLICK HERE
DOWLOAD NOW
https://ebookname.com/product/beaglebone-cookbook-software-and-
hardware-problems-and-solutions-1st-edition-mark-a-yoder/
ebookname.com
https://ebookname.com/product/raspberry-pi-hardware-reference-1st-ed-
edition-gay/
ebookname.com
https://ebookname.com/product/raspberry-pi-tricks-and-tips-7th-
edition-unk/
ebookname.com
https://ebookname.com/product/western-civilization-a-history-of-
european-society-second-edition-steven-hause/
ebookname.com
Purity Body and Self in Early Rabbinic Literature 1st
Edition Mira Balberg
https://ebookname.com/product/purity-body-and-self-in-early-rabbinic-
literature-1st-edition-mira-balberg/
ebookname.com
https://ebookname.com/product/skepticism-1st-edition-annalisa-coliva/
ebookname.com
https://ebookname.com/product/credit-risk-scorecards-naeem-siddiqi/
ebookname.com
https://ebookname.com/product/closed-loop-neuroscience-1st-edition-
ahmed-el-hady/
ebookname.com
The Neuroscience of Religious Experience 1st Edition
Patrick Mcnamara
https://ebookname.com/product/the-neuroscience-of-religious-
experience-1st-edition-patrick-mcnamara/
ebookname.com
Raspberry Pi Cookbook
Simon Monk
Raspberry Pi Cookbook
by Simon Monk
Copyright © 2014 Simon Monk. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editor: Rachel Roumeliotis Indexer: Judy McConville
Production Editor: Melanie Yarbrough Cover Designer: Karen Montgomery
Copyeditor: Nancy Reinhardt Interior Designer: David Futato
Proofreader: Rachel Monaghan Illustrator: Rebecca Demarest
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Raspberry Pi Cookbook, the image of a Eurasian sparrowhawk, and related trade dress are trade‐
marks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-36522-6
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
2. Networking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.1. Connecting to a Wired Network 31
2.2. Finding Out Your IP Address 33
2.3. Setting a Static IP Address 35
2.4. Setting the Network Name of a Raspberry Pi 36
2.5. Setting Up a Wireless Connection 37
2.6. Connecting with a Console Lead 38
iii
2.7. Controlling the Pi Remotely with SSH 40
2.8. Controlling the Pi Remotely with VNC 42
2.9. File Sharing on a Mac Network 44
2.10. Sharing the Pi Screen on a Mac 45
2.11. Using a Raspberry Pi for Network Attached Storage 47
2.12. Network Printing 49
3. Operating System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.1. Moving Files Around Graphically 53
3.2. Starting a Terminal Session 55
3.3. Navigating the Filesystem Using a Terminal 56
3.4. Copying a File or Folder 60
3.5. Renaming a File or Folder 61
3.6. Editing a File 61
3.7. Viewing the Contents of a File 64
3.8. Creating a File Without Using an Editor 64
3.9. Creating a Directory 65
3.10. Deleting a File or Directory 66
3.11. Performing Tasks with Superuser Privileges 67
3.12. Understanding File Permissions 68
3.13. Changing File Permissions 69
3.14. Changing File Ownership 70
3.15. Making a Screen Capture 71
3.16. Installing Software with apt-get 72
3.17. Removing Software Installed with apt-get 73
3.18. Fetching Files from the Command Line 74
3.19. Fetching Source Code with git 75
3.20. Running a Program or Script Automatically on Startup 76
3.21. Running a Program or Script Automatically at Regular Intervals 78
3.22. Finding Things 79
3.23. Using the Command-Line History 80
3.24. Monitoring Processor Activity 81
3.25. Working with File Archives 83
3.26. Listing Connected USB Devices 84
3.27. Redirecting Output from the Command Line to a File 84
3.28. Concatenating Files 85
3.29. Using Pipes 86
3.30. Hiding Output to the Terminal 86
3.31. Running Programs in the Background 87
3.32. Creating Command Aliases 88
3.33. Setting the Date and Time 88
iv | Table of Contents
3.34. Finding Out How Much Room You Have on the SD Card 89
4. Software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.1. Making a Media Center 91
4.2. Installing Office Software 94
4.3. Installing other Browsers 95
4.4. Using the Pi Store 97
4.5. Making a Webcam Server 99
4.6. Running a Vintage Game Console Emulator 101
4.7. Running Minecraft 103
4.8. Running Open Arena 104
4.9. Raspberry Pi Radio Transmitter 105
4.10. Running GIMP 107
4.11. Internet Radio 108
Table of Contents | v
6.1. Creating a List 135
6.2. Accessing Elements of a List 136
6.3. Find the Length of a List 137
6.4. Adding Elements to a List 137
6.5. Removing Elements from a List 138
6.6. Creating a List by Parsing a String 139
6.7. Iterating over a List 139
6.8. Enumerating a List 140
6.9. Sorting a List 141
6.10. Cutting Up a List 142
6.11. Applying a Function to a List 143
6.12. Creating a Dictionary 144
6.13. Accessing a Dictionary 145
6.14. Removing Things from a Dictionary 146
6.15. Iterating over Dictionaries 147
vi | Table of Contents
8.8. Installing PySerial for Access to the Serial Port from Python 175
8.9. Installing Minicom to Test the Serial Port 176
8.10. Using a Breadboard with Jumper Leads 178
8.11. Using a Breadboard with a Pi Cobbler 179
8.12. Converting 5V Signals to 3.3V with Two Resistors 179
8.13. Converting 5V Signals to 3.3V with a Level Converter Module 181
8.14. Powering a Raspberry Pi with Batteries 183
8.15. Powering a Raspberry Pi with a LiPo Battery 184
8.16. Getting Started with a PiFace Digital Interface Board 185
8.17. Getting Started with a Gertboard 189
8.18. Getting Started with a RaspiRobot Board 191
8.19. Using a Humble Pi Prototyping Board 194
8.20. Using a Pi Plate Prototyping Board 195
8.21. Using a Paddle Terminal Breakout Board 197
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Table of Contents | ix
Preface
Since its launch in 2011, the Raspberry Pi has found a role both as a very low-cost Linux-
based computer and as a platform for embedded computing. It has proven popular with
educators and hobbyists alike, with over 2 million units sold since its release.
In this book, you will find a wide range of recipes using the Raspberry Pi, including
recipes for getting started and setting up your Pi; recipes for using the Python pro‐
gramming language; and a large number of recipes about using the Raspberry Pi with
sensors, displays, motors, and so on. The book also includes a chapter on using the
Raspberry Pi with Arduino boards.
This book is designed in such a way that you can read it linearly, as you would a regular
book, or access recipes at random. You can search the table of contents or index for the
recipe that you want and then jump right to it. If the recipe requires you to know about
other things, then it will refer you to other recipes, rather like a cookbook might refer
you to base sauces before showing you how to cook something fancier.
The world of Raspberry Pi is one that moves quickly. With a large active community,
new interface boards and software libraries are being developed all the time. So, besides
many examples that use specific interface boards or pieces of software, the book also
covers basic principles so that you can have a better understanding of how to use new
technologies that come along as the Raspberry Pi ecosystem develops.
As you would expect, there is a large body of code (mostly Python programs) that
accompanies the book. These programs are all open source and available on GitHub.
You’ll find a link to them at the Raspberry Pi Cookbook website.
For most of the software-based recipes, all you need is a Raspberry Pi. I recommend a
Raspberry Pi model B. For recipes that involve making your own hardware to interface
with the Raspberry Pi, I have tried to make good use of ready-made modules, as well as
solderless breadboard and jumper wires to avoid the need for soldering.
xi
For those wishing to make breadboard-based projects more durable, I suggest using
protoyping boards with the same layout as a half-sized breadboard, such as those sold
by Adafruit, so that the design can easily be transferred to a soldered solution.
This icon points you to the related video for that section.
xii | Preface
books does require permission. Answering a question by citing this book and quoting
example code does not require permission. Incorporating a significant amount of ex‐
ample code from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “Raspberry Pi Cookbook by Simon Monk
(O’Reilly). Copyright 2014 Simon Monk, 978-1-449-36522-6.”
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at permissions@oreilly.com.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://oreil.ly/raspberry-pi-cb.
Preface | xiii
Random documents with unrelated
content Scribd suggests to you:
ja katosi tiheään pensaikkoon kenenkään häntä näkemättä. Hän oli
kohdannut saksalaisia, mutta ei niitä, jotka olivat surmanneet hänen
vaimonsa, ja niidenhän käsiinsä saaminen vain oli nyt hänen
tarkoituksensa. Hän ei käynyt sotaa eikä tullut ajatelleeksi, että
kotoinen verinäytelmä oli voinut olla taistelun vääjäämätöntä
yleistuhoa.
Astuen pöydän luo, jonka takana kenraali seisoi, hän otti takkinsa
sisätaskusta kokoonkäärityn paperin ja ojensi sen kenraalille.
Yksi ainoa silmäys näytti että vartijan paikka yhä oli tyhjä, ja
hetkeä myöhemmin hän taakkoineen oli erään heinäkasan varjossa.
Majuri Schneider ei ollut päästänyt yhtään ääntä siitä
yksinkertaisesta syystä että kurkkunsa oli lujissa pinteissä. Nyt
Tarzan hellitti otettaan niin paljon, että mies sai vetäistä henkeään.
"Jos äännähdät, niin tukin taas kurkkusi", sanoi hän. Varovasti ja
loppumattoman kärsivällisesti vältettyään kaikki vaarat Tarzan kulki
viimeisen vartioston ohi. Pakottaen vankinsa kulkemaan edellään hän
yhä samosi länteen päin, kunnes myöhään illalla kulki rautatien
poikki, jolloin alkoi tuntea olevansa melkein turvassa ilmitulemiselta.
Saksalainen oli kironnut, mutissut itsekseen, uhkaillut ja kysellyt,
mutta hänen saamansa ainoa vastaus oli uusi pistos Tarzanin
terävästä sotakeihäästä.
Kuka ja mikä oli tuo alaston valkoinen villi? Hän oli kuullut hänen
puhuvan vain kerran — hänen varoittaessaan häntä olemaan ääneti
— ja silloin hän oli puhunut erinomaista saksaa ja äänessä oli ollut
sivistyksen hienostama sointu. Hän katseli häneen kuin sammakko
käärmeeseen, joka on nielemäisillään sen. Hän näki nuo sirot jäsenet
ja sopusuhtaisen ruumiin liikkumattomana kuin marmoripatsaan
Tarzanin kyräillessä uhkean lehvistön peitossa. Ei värähtänyt
yksikään lihas eikä hermo. Hän näki peurojen pahaa aavistamatta
tulevan verkalleen polkua tuulen yläpuolelta. Hän näki erään uroksen
menevän ohi — vanhan peuran — ja sitten nuoren ja rehevän
tulevan väijyksissä olevaa jättiläistä vastaan. Samassa Schneiderin
silmät pullistuivat ja kauhun huuto oli vähällä päästä hänen
huuliltaan, kun näki ketterän pedon sivultaan loikkaavan suoraa
päätä nuoren peuran niskaan ja kuuli noilta ihmishuulilta villipedon
metsästyskarjahduksen. Eläin kaatui, ja Tarzan vankineen sai lihaa.
Apinamies söi omansa raakana, mutta salli saksalaisen tehdä tulen ja
keittää omansa. Molemmat makailivat myöhään iltapuoleen ja
lähtivät sitten taas matkaan, joka pelotti Schneideriä, hän kun ei
tietänyt sen määrästä. Epätietoisuus ahdisti häntä toisinaan siihen
määrin, että hän ihan pyyteli Tarzanilta selitystä seikkailuun, mutta
ääneti apinamies yhä samosi ja heti hoputti häntä, kun hän vähänkin
viivästeli.
Saksalaisten rintamalla
Tarzan astui puusta, lopetti ne, jotka eivät vielä olleet kuolleet, ja
ryhtyi sitten ruhoja nylkemään. Työskennellessään nopeasti ja
sangen taitavasti hän ei hyräillyt eikä vihellellyt kuten tavallinen mies
sivistysmaissa tekee. Lukuisissa tällaisissa pikku piirteissä hän erosi
muista ihmisistä, mikä luultavasti johtui hänen aikaisemmasta
viidakkokasvatuksestaan. Hänen kasvinkumppaninsa aarniometsän
pedot leikkivät vain kypsyys-ikään asti, harvoin sen jälkeen. Hänen
apinatoverinsa, etenkin urokset, kävivät vanhetessaan julmiksi ja
äreiksi. Elämä ei ollut leikintekoa niukan vuodenajan vallitessa —
yksilön oli oteltava saadakseen osansa ruuasta, ja kerran syntynyt
tapa jäi sitten eliniäksi. Ruuan hankkiminen tuli viidakon asujamen
elämäntyöksi, ja se on seikka, jota ei käy harjoittaminen kevein
mielin. Tarzan siis piti kaikkea työtä vakavana hommana, vaikka hän
vielä säilyttikin sen, minkä muut pedot vanhetessaan menettävät —
leikillisyyden tajun, jonka hän päästi valloilleen ollessaan sillä päällä.
Hänen huumorinsa oli nyreätä ja toisinaan kauheaa, mutta se
tyydytti häntä. Jos sitäpaitsi laulaisi ja viheltelisi työssään, ei voisi
siihen keskittyä. Tarzanilla oli kyky keskittää jokainen viidestä
aististaan niille kullekin kuuluvaan erikoistehtävään. Hänen
nylkiessään kuutta metsäsikaa hänen silmänsä ja sormensa
työskentelivät kuin ei koko maailmassa olisi muuta kuin nämä kuusi
ruhoa, mutta samalla hänen korvansa ja nenänsä toimivat muualla
— edellinen tarkkaili koko metsää ja jälkimäinen nuuhki jokaista
tuulenhenkäystä. Hänen nenänsä se ensin keksikin Sabor-
leijonattaren tulon, kun tuuli hetkeksi vaihtoi suuntaa.
Vihdoin hän seisoi rotkon pohjalla. Hiljaa kuin ruumiiton henki hän
läksi kohti puuta. Hän oli jo puolitiessä, eikä Numaa vieläkään
näkynyt. Hän tuli revitylle rungolle, josta nälistynyt leijona oli syönyt
kuoren, vieläpä lisäksi kynsinyt palasia itse puusta, eikä Numaa vain
näkynyt. Vetäessään itsensä puun alaoksalle hän alkoi ihmetellä,
oliko leijona ollenkaan luolassa. Olisikohan se särkenyt kivivallin,
jonka Tarzan oli laittanut vapauteen johtavan käytävän suulle? Tai
oliko Numa kuollut? Apinamies epäili viimeistä otaksumaa, sillä
hänhän oli vain muutamia päiviä sitten jättänyt sille kauriin ja
hyenan koko ruhot — ei se olisi voinut menehtyä niin lyhyessä
ajassa, kun lisäksi rotkon poikki juokseva puronen tarjosi sille yllin
kyllin juomaa.
Ensin hän veti suuremman säkin yli Numan pään ja sitoi sen
vetonuoralla leijonan kaulan ympäri; sitten hänen onnistui suurin
vaivoin ja ollen vähällä tulla rikki revityksi kiskoa remmeillään pedon
neljä jalkaa yhteen ja kytkeä ne siihen asentoon.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com