The MagPi issue 9, Science, Technology, IT, Raspberry Pi
[ Pobierz całość w formacie PDF ]
I
I
S
S
S
S
U
U
E
E
0
0
9
9
F
F
E
E
B
B
2
2
0
0
1
1
3
3
Getprintedcopiesof
issues18plusbinder
at
A
A
M
M
a
a
g
g
a
a
z
z
i
i
n
n
e
e
f
f
o
o
r
r
R
R
a
a
s
s
p
p
b
b
e
e
r
r
r
r
y
y
P
P
i
i
U
U
s
s
e
e
r
r
s
s
M
M
e
e
e
e
t
t
L
L
a
a
d
d
y
y
a
a
d
d
a
a
T
T
h
h
i
i
s
s
I
I
s
s
s
s
u
u
e
e
.
.
.
.
.
.
W
W
e
e
b
b
I
I
O
O
P
P
i
i
F
F
r
r
a
a
m
m
e
e
w
w
o
o
r
r
k
k
B
B
a
a
c
c
k
k
u
u
p
p
S
S
D
D
c
c
a
a
r
r
d
d
s
s
V
V
a
a
l
l
a
a
&
&
L
L
e
e
d
d
B
B
o
o
r
r
g
g
S
S
c
c
r
r
a
a
t
t
c
c
h
h
G
G
P
P
I
I
O
O
R
R
I
I
S
S
C
C
O
O
S
S
A
A
n
n
i
i
n
n
t
t
e
e
r
r
v
v
i
i
e
e
w
w
w
w
i
i
t
t
h
h
t
t
h
h
e
e
F
F
o
o
u
u
n
n
d
d
e
e
r
r
o
o
f
f
A
A
d
d
a
a
f
f
r
r
u
u
i
i
t
t
I
I
n
n
d
d
u
u
s
s
t
t
r
r
i
i
e
e
s
s
RaspberryPiisatrademarkofTheRaspberryPiFoundation.
ThismagazinewascreatedusingaRaspberryPicomputer.
h
h
t
t
t
t
p
p
:
:
/
/
/
/
w
w
w
w
w
w
.
.
t
t
h
h
e
e
m
m
a
a
g
g
p
p
i
i
.
.
c
c
o
o
m
m
WelcometoIssueNine,
Manythankstoallofyouwhogenerouslysupportedourkickstarter
project.Thekickstarterraisedoverfourtimesthetargetamount,with
616backers.Afterasmalldelay,wearegearingupforprinting.The
folderdesignforVolume1(Issues1to8)hasbeenfinalised.Ifyou
missedoutonthekickstarter,thenVolume1canstillbeorderedfromour
onlineshopwww.themagpi.com/shop/
Thismonthweareverypleasedtopresentaninterviewwithengineer
andfounderofAdafruitIndustries,LimorFried.Shehasbeenan
encouragementtomany,providingtutorials,answeringquestionsand
supplyingpartstobuildallsortsofinterestingprojects.
Thisissuealsocontainshardwarearticles,setupinstructionsforRISCOS
andArchLinuxoperatingsystems,andourregularprogrammingarticles
onScratch,PythonandC.
AshStone
ChiefEditorofTheMagPi
MagPi team
Ash Stone-ChiefEditor/Administrator
Tim 'meltwater' Cox-Writer/PageDesigns/Admin
.
Chris 'tzj' Stagg-Writer/Photographer/PageDesigns
Colin Deady-Writer/PageDesigns
Jason 'Jaseman' Davies-Website/PageDesigns
Matt '0the0judge0'-Website/Administrator
Aaron Shaw-Writer/PageDesigns/Graphics
Ian McAlpine-Writer/PageDesigns/Graphics
Sam Marshall-PageDesigns/Graphics
W. H. Bell-Writer/PageDesigns
Bryan Butler-PageDesigns/Graphics
Colin Norris-Graphics
Mark Robson-Proof-reading
Alex Baker-Proof-reading
Richard Wenner-Proof-reading
Steve Drew-Proof-reading
Chosp-Proof-reading
Benjamin Donald-Wilson-Proof-reading
Mike Richards-Proof-reading
Guest writers
Alex Eames
Eric PTAK
Norman Dunbar
Pete Nowosad
Ross Taylor
Simon Walters
Cover:
LimorFried,engineerandfounderofAdafruitIndustries.
2
Contents
04
An interview with Limor Fried from Adafruit
FounderandengineerofAdafruitIndustriesLimorFriedtalkstotheMagPi.
08
WebIOPi - Raspberry Pi REST framework
LearnhowtocontroltheRaspberryPi'sGPIOinterfacefromawebbrowser.
12
Backing up your Raspberry Pi
BackupyourSDcardwithoptionalcompressionandDVDarchiving.
15
Win some more Raspberry Pi goodies
ThismonththereisanopportunitytowinaGertboard.
16
Quick2Wire's I/O interface board for the Raspberry Pi
Areviewofthekitandtheassembledboard.
18
An introduction to RISCOS
AbasicintroductiontotheRISCOSoperatingsystem,fromSDcardinstallationtothedesktop.
20
Installing & configuring Arch Linux
LearnhowtoinstallArchLinux,abarebonesrollingLinuxdistributionontheRaspberryPi.
22
An introduction to Vala programming
WritingcodeinaVala,ahighlevelC#stylelanguage.
24
This month's Raspberry Pi events
Findoutwhatisonthismonth.
26
The C Cave - structs, histograms and data analysis
Learnhowtobuildmorecomplicateddatastructuresandprograms.
32
Scratch Patch - controlling the GPIO interface from Scratch
LearnthefirststepstoGPIOcontrol,allowingmorecomplicatedinterfacing.
34
The Python Pit - drive your Raspberry Pi with a mobile phone
Anintroductiontowebpy,providingmobilephoneconnectionstopythonprojects.
36
Feedback and question time
Commentsandfeedbackfromreaders.
3
She is an open source hardware advocate, founderofAdafruit
andwas voted"Entrepreneurof2012". Who is LimorFried?
[MagPi] Fi rst our congratul ati ons on bei ng
awarded Entrepreneur magazi ne’ s
“Entrepreneur of 201 2” l ast month. Do you
thi nk thi s i s the fi rst si gn of mai nstream
acceptance of “hacki ng” , i n i ts true defi ni ti on
and the “maker” movement i n general ?
degree i n El ectri cal Engi neeri ng and
Computer Sci ence. What i nspi red you to start
your own company rather than “cut your teeth”
wi th an i ndustry empl oyer?
[Limor] Runni ng your own company i sn't for
everyone, I wasn't even sure i t was for me at
fi rst, but the freedom and fl exi bi l i ty to pursue
whatever you want and work on the i mportant
thi ngs i s seducti ve and
rewardi ng. There's a ton of
ri sk of course, but the
bi ggest ri sk i s regret l ater i f
you don't at l east try.
There's never been a
better ti me to run a
company that cel ebrates
smart peopl e, smart
communi ti es and l earni ng.
The demand for efforts l i ke
the Raspberry Pi has total y
changed Adafrui t. Anyone
can l earn to desi gn
el ectroni cs, wri te code and
have mul ti pl e ways to get
the products i n the hands
of customers. One of the
thi ngs about runni ng a
company i s you can take
on some proj ects that at
fi rst do not seem to have
i mpact on the bottom l i ne,
but you can take the ri sk.
M any of the proj ects we do at Adafrui t woul d
never be approved by a bi g company sol el y
focused on a few products. We have over
1 , 200 products and some of them are purel y
experi mental .
[Limor] Thank you so much for the ki nd
words. The Raspberry Pi communi ty deserves
a l ot of thanks as wel l , al l of
the voti ng was vi a the
i nternet and the Pi
communi ty real l y ral l i ed for
us! I bel i eve the maker
movement i s past the "i s
thi s a real thi ng?" stage.
About 6 years ago I was
i nvi ted to a conference
about the new maker
movement that had j ust
started to happen and a
very l arge company made
a poi nt to say Adafrui t was
not a real company. I t's
been a chal l enge every day
to prove a great busi ness
can support a great cause
l i ke open-source. Bei ng
awarded Entrepreneur
magazi ne's "Entrepreneur
of the year" means there
are l ess barri ers for
someone starti ng out now.
They don't need to hear somethi ng i s not
possi bl e or not real , they can see there are
unl i mi ted opportuni ti es for maki ng and shari ng
- and runni ng a successful busi ness.
[MagPi] We’ re getti ng a l i ttl e ahead of
oursel ves. Let’ s take a step back. You are the
founder and engi neer of Adafrui t, the N ew
York based company that you formed i n 2005
after
[MagPi]Your ni ckname i s “Ladyada” whi ch I
am assumi ng has some rel ati on to Lady Ada
Lovel ace, the worl d’ s fi rst computer
programmer? Of course the l i nk to Adafrui t i s
more
you
graduated
from
the
M assachusetts
I nsti tute of Technol ogy (M I T)
wi th
a master's
obvi ous,
but
what
was
the
i nspi rati on
4
behi nd
the
name?
M aybe
you
had
a
can see that the Raspberry Pi secti on i s one of
the l argest.
premoni ti on
that
you
woul d
be
worki ng
wi th
raspberri es one day?
[Limor] At Adafrui t we have a bi g goal and
mi ssi on; to teach ki ds programmi ng and
maki ng. . . and i t's actual l y teach everyone, not
j ust ki ds. We thi nk everyone shoul d be abl e to
use a l ow-cost educati onal computer to l earn
el ectroni cs and of course l earn a computer
l anguage. We struggl ed wi th how we woul d be
abl e to start thi s endeavor and that's when the
Raspberry Pi was announced. I t became so
popul ar so qui ckl y that i t real l y kept us on our
toes meeti ng demand. Every si ngl e thi ng we
desi gn or curate i n the store i s tested by me.
For the Raspberry Pi we knew i t woul d be
i mportant to have the best educati onal
resources i n addi ti on to the best support. Si x
months l ater, the Pi secti on i s one of our
l argest and the Pi tutori al s are the most
vi ewed on the Adafrui t Learni ng System
[Limor]When I was younger al l I di d was pl ay
around wi th Li nux, i nstal l i ng i t on anythi ng I
coul d fi nd and expl ori ng al l the thi ngs that
made i t work. I n my hacker days, actual l y I 'm
sti l l i n those days now : ) … , my ni ckname was
Ada. I was al ways programmi ng, bui l di ng,
reverse engi neeri ng so the Ladyada name has
stuck wi th me from the start. Looki ng back at
al l the Li nux hacki ng i t seems l i ke I was i n
trai ni ng to work on the Raspberry Pi . For the
younger fol ks out there who l i ke spendi ng ti me
hacki ng
away,
i t
real l y
can
end
up
bei ng
a
fantasti c adventure and a career!
[MagPi] We have al l heard of open source
software and i t i s used every day by mi l l i ons of
peopl e, i ncl udi ng 1 mi l l i on pl us Raspberry Pi
users. But you are heavi l y i nvol ved i n the open
source hardware communi ty. I ndeed al l
Adafrui t products are made avai l abl e as open
source
hardware
wi th
free
downl oad
of
schemati cs,
PCB
l ayouts,
fi rmware
and
software.
Ardui no
i s
a
popul ar
exampl e
of
open
source
hardware
but
can
you
tel l
us
more
about
what
you
thi nk
i s
the
future
of
open source hardware?
[Limor]I l i ke to ski p to the end of the story, al l
hardware i s copyabl e. There are trademarks
for l ogos and names and patents for some
thi ngs, but i f i t's made out of physi cal bi ts and
i t's i nteresti ng, someone i s goi ng to copy i t. So
I 've al ways worked back from that, i f someone
i s goi ng to copy somethi ng of mi ne I shoul d do
my best to make i t educati onal , fun and hel p
soci ety. I n a worl d where compani es l i ke
Appl e and Samsung are sui ng each other i t's
pretty cl ear that progress stops when you
thi nk you can stop copyi ng. One way to l ook at
i t i s reci pes, we can al l make any di sh we l i ke
at home, but we go to restaurants for an
experi ence. That's how I l ook at hardware,
you're not j ust buyi ng the physi cal bi ts from
Adafrui t, you're getti ng the servi ce, support
and communi ty of makers. I n the future every
hardware company wi l l need to be a cause
and a busi ness, Raspberry Pi and Ardui no are
great exampl es.
TheAdafruitexclusivePibowcase
But wai t, there's more! We al so knew we'd
need a great web-based way to teach, so
we've i nvested a l ot of ti me and resources i n
bui l di ng our own i ntegrated devel opment
envi ronment (I DE) , compl ete wi th step
debuggi ng and vi sual i zer. The Raspberry Pi
WebI DE i s by far the easi est way to run code
on your Raspberry Pi . J ust connect your Pi to
your l ocal network. Then l og on to the WebI DE
i n your web browser to edi t Python, Ruby,
J avaScri pt, or anythi ng and easi l y send i t over
to your Pi . Al so, your code wi l l be versi oned i n
a l ocal gi t reposi tory, and pushed remotel y out
to bi tbucket so you can access i t from
anywhere, and any ti me. Watch the vi deo
at
[MagPi] What got you i nterested i n the
Raspberry Pi ? Looki ng at
Continuedoverpage...
5
[ Pobierz całość w formacie PDF ]