MagPi54.pdf

(26210 KB) Pobierz
THE
OFFICIAL
RASPBERRY PI MAGAZINE
The official Raspberry Pi magazine
Issue 54 February 2017
raspberrypi.org/magpi
MAKE A NIGHT-VISION
NATURE CAMERA
Create your own Raspberry Pi-powered
motion-sensing camera trap
MULTI-BOOT
YOUR PI
The second part of
our expert tutorial
COMMAND
LINE GUIDE
Sudo apt-get good!
LEARN TO
CODE WITH C
Simplify common
operations on strings
HAPPY 5TH
BIRTHDAY!
Join Raspberry Pi
on the big day
Als
o
insid
e
:
>
CREATE AN EMPATHETIC ROBOT? HOW THOUGHTFUL
>
OPEN SOURCE CLOUD STORAGE POWERED BY PI
>
RASPBERRY PI ROBOTICS KITS MUST BE WON!
>
PIMORONI'S NEW PAN AND TILT HAT REVIEWED
The follow-up
to last month's
bumper guide!
PROGRAMMING
Issue 54
Feb 2017
£5.99
OBJECT
-ORIENTED
02
9 772051 998001
THE
ONLY
PI MAGAZINE WRITTEN BY THE RASPBERRY PI COMMUNITY
Welcome
WELCOME TO
THE OFFICIAL
MAGAZINE
and minds of enthusiasts throughout
the Raspberry Pi community: the magic
mirror. A wonderful, useful piece of home
automation straight out of Tony Stark’s house
that you can build with a Raspberry Pi, an old
monitor, and some wood.
We’ve wanted to do a magic mirror tutorial
in the magazine for quite some time, so it was
a delight that one of the driving forces behind
it, Michael Teeuw, agreed to help us create the
definitive guide to powering up your home.
If home automation isn’t your thing, we have
some great coding projects this issue, such as
more from Simon Long on coding with C, the
conclusion of our multi-booting guide, and the
continuation of Lucy Hattersley’s beginner’s
coding guide with a look at object-oriented
programming. As for me, among other things I’ve
reviewed a robot. I like robots; they’re fun. Take a
look for yourself and see if you agree…
I hope you enjoy this issue!
PAGE 2
6
I
t’s a project that has captured the hearts
SEE PAGE 26 FOR DETAILS
THIS MONTH:
14
CREATE A MAGIC MIRROR
28
A MUSEUM IN A BOX
Learning has never been so fun
Make the ultimate Pi project with our extensive guide
38
COMMAND LINE 101
Get the lowdown on mastering the command line
Rob Zwetsloot
Features Editor
66
MORE BEGINNER’S CODING
Learn about object-oriented programming
FIND US ONLINE
raspberrypi.org/magpi
EDITORIAL
DESIGN
GET IN TOUCH
magpi@raspberrypi.org
PUBLISHING
Managing Editor:
Russell Barnes
russell@raspberrypi.org
Features Editor:
Rob Zwetsloot
News Editor:
Lucy Hattersley
Sub Editors:
Laura Clay, Phil King, Lorna Lynch
Critical Media:
criticalmedia.co.uk
Head of Design:
Dougal Matthews
Designers:
Lee Allen, Daiva Bumelyte,
Mike Kay
Illustrator:
Sam Alder
For advertising & licensing:
russell@raspberrypi.org +44 (0)7904 766523
Publisher:
Liz Upton
CEO:
Eben Upton
DISTRIBUTION
Seymour Distribution Ltd
2 East Poultry Ave
London
EC1A 9PT |
+44 (0)207 429 4000
This magazine is printed on paper sourced from
sustainable forests and the printer operates an
environmental management system which has
been assessed as conforming to ISO 14001.
SUBSCRIPTIONS
Select Publisher Services Ltd
PO Box 6337
Bournemouth
BH1 9EH |
+44 (0)1202 586 848
CONTRIBUTORS
Sam Aaron, Alex Bate, Henry Budden, John Cole,
Mike Cook, Gareth Halfacree, Phil King, Simon Long,
Winfried Plappert, Matt Richardson, Richard
Smedley & Michael Teeuw
The MagPi magazine is published by Raspberry Pi (Trading) Ltd., 30 Station Road, Cambridge, CB1 2JH. The publisher,
editor, and contributors accept no responsibility in respect of any omissions or errors relating to goods, products or services
referred to or advertised in the magazine. Except where otherwise noted, content in this magazine is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0). ISSN: 2051-9982.
raspberrypi.org/magpi
February
2016
April
2017
3
Contents
Issue 54 February 2017
raspberrypi.org/magpi
TUTORIALS
>
PI 101 – COMMAND LINE TIPS
Our bumper guide to conquering the command line
COVER FEATURE
38
>
BUILD AN EMOTIONAL ROBOT
44
Create an empathetic automaton that reacts to people
>
NIGHT-TIME WILDLIFE PHOTOS
46
Use a Pi NoIR to make an outdoor IR nature camera
>
INTRODUCTION TO C PART 8
Master string libraries to simplify your code
50
52
58
>
CREATE A DRUM MACHINE
Tap Pringles cans to make a beat in the Pi Bakery
>
MULTI-BOOT YOUR PI PART 2
>
CREATE SOUNDS IN SONIC PI
Combine sounds together to make whole new ones
Add multiple operating systems to your Raspberry Pi
14
60
MAGIC MIRROR
COMPUTE
MODULE 3
IN THE NEWS
ONLINE TRAINING
PI IS 5
Free online learning resources available
06
The latest developer
spin of the Raspberry Pi
is out now
08
Celebrate the Pi’s fifth
birthday this March
12
4
February 2017
raspberrypi.org/magpi
Contents
THE BIG FEATURE
94
APL ON PI
LEARN MORE CODE
Following on from last issue’s coding guide, learn more
about Python and other object-oriented programming
66
We interview Dyalog about
the comeback of APL
84
06
62
82
96
YOUR PROJECTS
REGULARS
>
NEWS
>
TECHNICAL FAQ
>
BOOK REVIEWS
>
FINAL WORD
COMMUNITY
>
THIS MONTH IN PI
What else happened in the world of Pi?
86
88
90
92
28
>
COMMUNITY SPOTLIGHT
>
EVENTS
Find a community event near you
This time we talk to a mother and son team of makers
MUSEUM IN A BOX
Portable and small museum exhibits that fit in a box
>
LETTERS
We answer your pressing questions about the mag
NASA BCSI
A shoe fit for an astronaut
32
REVIEWS
>
NEXTCLOUD BOX
76
78
79
80
February 2017
5
GERO
How one maker created a bipedal Pi robot
34
>
SCRATCH CODING CARDS
>
PAN-TILT HAT
>
ROBOT ROVER KIT
raspberrypi.org/magpi
Zgłoś jeśli naruszono regulamin