The MagPi Issue 3 Final.pdf

(15293 KB) Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
I I S S S S U U E E 0 0 3 3 J J U U L L 2 2 0 0 1 1 2 2
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
F F i i r r e e d d u u p p a a n n d d
r r e e a a d d y y t t o o g g o o
1 1 5 5 0 0 + +
G G A A M M E E S S
D D e e b b i i a a n n E E s s s s e e n n t t i i a a l l s s
T T O O T T R R Y Y
O O N N Y Y O O U U R R P P I I
T T h h e e C C C C a a v v e e
S S c c r r a a t t c c h h P P a a t t c c h h
QRCode:
P P r r o o g g r r a a m m m m i i n n g g
F F u u n n d d a a m m e e n n t t a a l l s s
http://www.themagpi.com
RaspberryPiisatrademarkofTheRaspberryPiFoundation.
FrontCoverandFeedbackimageswerecreatedusingPhotofunia
857102103.024.png 857102103.025.png 857102103.026.png 857102103.027.png 857102103.001.png 857102103.002.png
WelcometoIssue3ofTheMagPi,acommunityleadmagazinekeepingyouuptodate
withallthingsRaspberryPi.
Thismonthhasseentheteamworkinghardsearchingandtesting9000stableDebian
packages,andidentifyingover150gamesand43appstotryoutonyourPi.
Meltwaterintroduceshisarticle‘MeetingPi’,offeringideasandtipsonintroducingthe
RaspberryPitousersofveryyoungages.Wefeatureanarticleonlowlevelprogramming
usingCandAlexKerrhasproducedhisarticle‘Programmingfundamentals’describing
howtousevariables,‘If’statementsandloops.
BodgeNHackittcontinueshisseries,explaininghowtoprogramtheUSBroboticarm
usingpython.DarrenteachesusmoreoninterfacingwiththePi,plusmorefromthe
reader’sfavourites­Commandline,ScratchPatchandthePythonPit.
Anemailthatcaughtmyeyethismonth
wasfromCayton­John,aged7,readingup
onthefirsteditionoftheMagPi.
Couldthisbeouryoungestreader?
Ifyouhavephotosreadingourmagazine,
pleasesendthemtoeditor@themagpi.com.
OnbehalfofTheMagPiteamwewanttothankWillBengtsonandhisteamatQRtfor
givingusourbeautifulpersonalTheMagPiQRcode.Pleasecheckouttheirsiteat
http://QRt.coandseetheirclevergeneratorandotherattractivework.
Finally,keepyourquestionsforLizandEbencominginandlookforourofficialinterview
innextmonthsmagazine.
WehopeyoucontinuetoenjoyreadingtheMagPiandthatit
inspiresyoutogetprogramming.
AshStone
ChiefEditorofTheMagPi
2
857102103.003.png 857102103.004.png 857102103.005.png 857102103.006.png
G G E E T T T T I I N N G G Y Y O O U U R R R R A A S S P P B B E E R R R R Y Y P P I I
T T O O A A U U T T O O B B O O O O T T T T O O L L X X D D E E
IfyouaretiredofloggingintoyourDebianSDcardwithusername:pi,password:raspberryandthentyping
startx,youcangetyourRaspberrytobootstraighttothegraphicalinterfacewithouthavingtotype
anything...
After logging in type:
sudo nano /etc/inittab
Scroll down to the line:
1:2345:respawn:/sbin/getty 115200 tty1
Change it to:
#1:2345:respawn:/sbin/getty 115200 tty1
(Put a # at the beginning to comment it out)
Add a line under it:
1:2345:respawn:/bin/login -f pi tty1</dev/tty1>/dev/tty1 2>&1
Press CTRL+X and Y to save changes
Then type:
sudo nano ~/.bash_profile
Type in:
startx
Press CTRL+X and Y to save changes
Then
sudo reboot
Your Pi should now boot up to LXDE automatically. I'm sure that will make many of you happy!
Make sure to follow those instructions carefully, and be aware of the lack of security - The contents of your Pi are
now open to anyone that has access to it. More useful Debian tips overpage.
ArticlebyJaseman
Contents
DebianEssentials
P.04
TheCCave
P.22
Interfacing(InControl)Part2
P.07
TheScratchPatch
P.24
CommandLineClinic
P.10
ThePythonPit
P.26
SkutterPart2
P.14
ProgrammingFundamentals
P.29
ProtectYourGPIOConnector
P.16
Feedback
P.30
MeetingPi
P.20
Weblinks&Credits
P.32
857102103.007.png 857102103.008.png 857102103.009.png 857102103.010.png
YoushouldalsocheckthesettingsofyourTVormonitor
(4:3/16:9aspectratio,imageadjust,panandzoom
settings).
INSTALLINGTHESOUNDDRIVERMODULE
IfyouintendtohavesoundthroughtheTV,makesurethe
TVvolumeisup,otherwiseconnecta3.5mmheadphone
cablefromthepi'sanalogueoutputtoyourspeakers/stereo
equipmentandswitchthemon.
E E S S S S E E N N T T I I A A L L S S F F O O R R Y Y O O U U R R R R A A S S P P B B E E R R R R Y Y P P I I
Theseproceduresweretestedwiththe
debian6­19­04­2012.imgfrom:
http://raspberrypi.org/downloads
Afterloggingintypethefollowingatthecommandprompt:
sudoapt­getupdate
sudoapt­getinstallalsa­utils (Answer'Y'ifaskedabout
diskspaceused)
sudomodprobesnd_bcm2835
(YouwillneedtohaveyourPiconnectedtotheinternet.)
REMOVINGTHEBLACKBORDERFROMAROUND
THESCREEN
IfyouwantsoundthroughtheHDMIcabletype:
sudoamixercsetnumid=32
Thisstepisonlyrequiredifyouarefindingablackborder
aroundtheedgeofyourscreenortheimageoverlapsthe
screen.
Orifyouwantsoundthroughtheanalogue(headphone)
sockettype:
sudoamixercsetnumid=31
Afterbootingupdebian,loginwith
username: pi
password: raspberry
Tomakesurethesounddrivermodulegetsloadedeach
timeyoubootuptype:
sudonano/etc/modules
Atthepi@raspberrypi:~$prompt,typein:
sudonano/boot/config.txt
Atthebottomofthefile(Undervchiq),addthefollowing:
snd_bcm2835
Typethefollowingintothenanotexteditor:
overscan_left=­10
overscan_right=­10
overscan_top=­10
overscan_bottom=­10
PressCtrl+XandthenYtosavethechanges.
Rebootthepi:
sudoreboot
PressCtrl+XtoExitandYtosayYestosavingthe
changes.
LoginandstarttheLXDEGraphicalInterfacebytyping:
startx
Whenyouarebackatthecommandprompttype:
sudoreboot
WhenLXDEhasloaded,Select'MusicPlayer'fromthe
Sound&Videomenu
Presstheplaybutton.Ifalliswellyoushouldheara40
secondpieceofmusiccalled'Cellule'bySilence.
Waitforthepitorebootandseeifthebordershavegone.
Repeattheprocessabovechangingthenumbersbyminus
10eachtime,untiltheborderisgone.Ifoundthatmy
HDMImonitorrequired­40forallsettings,butmyTV
workedbestwithzeroforleftandright,and­20forbothtop
andbottom.Youwillneedtofindthebestsettingstosuit
yourparticularscreen.
Ifthepicturegoesofftheedgeofthescreen.Justuse
positivenumbersfortheoverscanvalues.
Youcanusefilemanagertocopymp3musicfromaUSB
memorystickontoyourhomefolderorplaythemdirectly
throughMusicPlayer.Notehoweverthatitwon'tplaywma
files.
FIXINGGEANY(PythonEditor)
WhentryingtoexecutepythonscriptsfromGeanyyouwill
getanerror.
IFAFTERREBOOTINGYOUAREGETTINGNO
PICTURE:
Toresolvethis,gotoEdit>Preferences>Tools.
Youcanresetthesettingsbacktodefaultbytypingblindly:
pi
raspberry
sudorm/boot/config.txt­R
sudoreboot
Changethe'Terminal:'settingfrom'xterm'to
'/usr/bin/lxterminal'.
ClickApplyandOK.
INSTALLINGOMXPLAYER(CommandLineMovie
Player)
Thiswillremovetheconfig.txtfilecompletely.Afterthe
rebootyourpictureshouldreturn.Trysettingyour
overscanagainwithslightlylowernumbersuntilyoufind
thebestvalues.
TheOMXPlayerwillallowyoutoplayaviandmp4movies
onyourRaspberryPi.
Oralternatively,ifyouhaveaWindowsPCandacard
readeryoucanaccesstheconfig.txtfileandedititwith
Windowsnotepad.
Atthecommandprompttype:
wgethttp://seyrsnys.myzen.co.uk/rpi/omxplayer_0.0.1­
4
857102103.011.png 857102103.012.png 857102103.013.png 857102103.014.png 857102103.015.png 857102103.016.png
arm.deb
sudodpkg­iomxplayer_0.0.1­arm.deb
sudoapt­get­finstall
mc MidnightCommander­terminalfilemanager(Type
'mc')
milkytracker MusiccreationtoolinspiredbyFastTracker2
mtpaint PowerfulGraphicEditor
openoffice.org OfficeProductivitySuite
oxine MediaCenterforMPEG,MP3andWMA
qrencode QRCodeencoder>PNGimage(Typeqrencode
<string>­ofilename)
schism ImpulseTrackerClone
scribus DesktopPublishing(UsedtoproduceTheMagPi)
ghostscript PostScript/PDFinterpreter(UsewithScribus)
tuxpaint APaintProgramForYoungChildren
xball Simulatebouncingballsinawindow(Clickanddrag
inthewindow)
xchat IRCChatClient
xcircuit ElectricalDiagramPackage
xine­ui MediaPlayerforMPEG,MP3andWMA
xpad StickyNoteApplication
xpaint SimplePaintProgram
xtrkcad ModelTrainTrackCADProgram
yakuake Aterminalwindowdropsdownfromthetopofthe
screenwhenyoupressF12.
UsefilemanagertocopysomemoviefilesfromaUSB
deviceintoyourhomefolderthenfromthecommand
prompttype:
omxplayerfilename
Whilstplayingpress'p'topause'q'toquit.Arrowstojump
forward/back.
INSTALLINGCHROMIUMWEBBROWSER
ChromiumisslowonthePi,butitworkswellwiththe
followingusefulwebsites:
http://qwebirc.swiftirc.net­instantmessengerchatrooms
http://www.dropbox.com­upload/download/share/transfer
http://www.gmail.cominBasicHTMLmode­send/receive
googleemailwithattachments
sudoapt­getinstallchromium­browser
INSTALLINGXPDF
3dchess Game(3x2dboards)
abe Abe'sAmazingAdventureGame
ace­of­penguins Freecell,Solitaire+Minesweeper,Teipei...
airstrike 2DAirplaneDogfightingGame
atom4 ColorPuzzleGame
atris Tetrisgame
balazar3­2d Cool3DGame
beneath­a­steel­sky Sci­fiAdventureGame(NiceIntro!
XPDFisafreePDFdocumentviewer.
DownloadTheMagPipdf'sbyopeningMidoriwebbrowser,
andvisitinghttp://www.themagpi.com.Clickononeofthe
PDFdownloadmirrors.Choose'Save'andwatchthe
progressofthedownloadatthebottomrightofthe
browser.
)
blobwars MetalBlobSolid­Amazing2DPlatformGame
blockade PuzzleGame­commandline'sudoblockade'
bumprace 2DSpaceMazeGame
bygfoot FootballManagerGame
ceferino DonCeferinoHazaaPlatformGame
childsplay InteractiveChildrensGamesCollection
crimson CrimsonFieldsTacticalGame
dangen StrangeShoot'EmUpGame
dodgindiamond2 ArcadeShoot'EmUp(PressMforFire)
dossizola IsolaBoardGame
empire Text­OnlyEmpireBuildingGame
enigma PuzzleGame
etw EatTheWhistleFootballArcadeGame
fillets­ng FishFilletsPuzzleGame
flobopuyo Connect4meetsTetris
freealchemist BlockGame
freedink RPG(UseGNUFreeDinkfromOther)
freedroid ParanoidGameClone
frozen­bubble FrozenBubble2Game
geki2 Xenon­likeverticalshoot'emup(Fantastic!)
geki3 R­Type­likehorizontalshoot'emup(Amazing)
ghextris ATetrissudo­likeGameOnAHexagonalGrid
glotski SlideBlocksToReachAGoal
glpeces TangramPuzzleGameClone
gmchess ChineseChessGame(Xiangqi)
gnugo TheGameOf'Go'
gnujump PlaftormGame
gnuminishogi MiniShogi5x5Board(Type'help')
golly GameofLifeSimulator
gravitywars GravityForceClone
grhino Othello/ReversiBoardGame
groundhog SimpleLogicGame
gtans TangramPuzzleGame
gtkatlantic GameLikeMonopoly
gtkballs LogicGame
gtkboard ManyBoardGamesInOneProgram
Atthecommandline,type:
ls (checkthatTheMagPiIssueXFinal.pdfislisted)
sudoapt­getinstallxpdf (TypeYifaskedaboutdiskspace)
xpdf"TheMagpiIssue1Final.pdf" (Waitamomentandthe
pdfdocumentshouldbedisplayed)
OTHERAPPSANDGAMES
NOTE:Someofthesegetlistedunder'other'onthe
LXDEmenu.
Toinstalluse: sudoapt­getinstall <name>
Touninstall: sudoapt­getremove <name>
Tocleanup: sudoapt­getautoremove
abiword WordProcessor
amsn MSNMessenger(Slowtoopen/closebutworks)
audacity AudioEditor/Player
avifile­player UselessforvideobutplaysWMA+MP3music
brandy BBCBASICVProgramming(Type'brandy')
bwbasic BywaterBASICProgramming(Type'bwbasic')
espeak CommandLineText2SpeechSynth
evolution EmailCalendarContactsMemosTasks
extcalc PowerfulScientificCalculator
feh CommandLineImageViewer(Withmanyoptions)
filezilla FTPfilesharingclient
fotoxx PhotoEditor
fraqtive MandelbrotDesigner
galculator Calculator
gimp GNUImageManipulationProgram
gnumeric Spreadsheets
gpaint MSPaint­likedrawing
grafx2 256­ColorPaintProgram
grisbi PersonalFinanceManagementProgram
homebank ManagePersonalAccountsAtHome
lifeograph Privatedigitaldiary
matchbox On­screenKeyboard
Continuedoverpage...
5
857102103.017.png 857102103.018.png 857102103.019.png 857102103.020.png 857102103.021.png 857102103.022.png 857102103.023.png
Zgłoś jeśli naruszono regulamin