MagPi03.pdf

(12285 KB) Pobierz
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 h h e e C C C C a a v v e e
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
S S c c r r a a t t c c h h P P a a t t c c h h
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
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
RaspberryPi isatrademarkofTheRaspberryPiFoundation.
FrontCoverandFeedbackimageswerecreatedusingPhotofunia
1150080069.020.png 1150080069.021.png 1150080069.022.png 1150080069.023.png 1150080069.001.png 1150080069.002.png 1150080069.003.png
WelcometoIssue3ofTheMagPi,acommunityledmagazinekeepingyouuptodatewith
allthingsRaspberryPi.
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
givingusourbeautiful,personalTheMagPiQRcode.Pleasecheckouttheirsiteat
http://QRt.coandseetheirclevergeneratorandotherattractivework.
Finally,keepyourquestionsforLizandEbencominginandlookforourofficialinterview
innextmonth'smagazine.
WehopeyoucontinuetoenjoyreadingTheMagPiandthatit
inspiresyoutogetprogramming.
AshStone
ChiefEditorofTheMagPi
2
1150080069.004.png 1150080069.005.png 1150080069.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 W W I I T T H H O O U U T T L L O O G G I I N N
If you are tired of logging in to your Debian SD card with username: pi, password:
raspberry and then typing startx, you can get your Raspberry Pi to boot straight to the
graphical interface without having to type anything...
After logging in type:
sudonano/etc/inittab
Scroll down to the line:
1:2345:respawn:/sbin/getty115200tty1
Change it to:
#1:2345:respawn:/sbin/getty115200tty1
(Put a # at the beginning to comment it out)
Add a line under it:
1:2345:respawn:/bin/login-fpitty1</dev/tty1>/dev/tty12>&1
Press CTRL+X and Y to save changes
Then type:
sudonano~/.bash_profile
Type in:
startx
Press CTRL+X and Y to save changes
Then
sudoreboot
Your Raspberry Pi should now boot up to LXDE automatically. I'm sure that will make many of you happy!
Make sure to follow these instructions carefully and be aware of the lack of security - the contents of your Raspberry Pi
are now open to anyone that has access to it. More useful Debian tips are on the next page.
ArticlebyJaseman
Contents
Debian Essentials
P.04
P.22
The C Cave
Interfacing (In Control) Part 2
P.07
P.24
The Scratch Patch
Command Line Clinic
P.1 0
P.26
The Python Pit
Skutter Part 2
P.1 4
P.29
Programming Fundamentals
Protect Your GPIO Connector
P.1 6
P.30
Feedback
Meeting Pi
P.20
P.32
Weblinks & Credits
3
1150080069.007.png 1150080069.008.png 1150080069.009.png 1150080069.010.png
You should also check the settings of your TV or monitor
(4:3/16:9 aspect ratio, image adjust, pan and zoom
settings).
INSTALLING THE SOUND DRIVER MODULE
If you intend to have sound through the TV, make sure the
TV volume is up, otherwise connect a 3.5mm headphone
cable from the Pi's analogue output to your
speakers/stereo equipment and switch them on.
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
These procedures were tested with
debian6-1 9-04-201 2.img. Get the latest
from http://raspberrypi.org/downloads
Type the following at the command prompt:
sudo apt-get update
sudo apt-get install alsa-utils (Answer 'Y' if asked about
disk space used)
sudo modprobe snd_bcm2835
( You will need to have your Pi connected to the internet. )
REMOVING THE BLACK BORDER FROM
AROUND THE SCREEN
If you want sound through the HDMI cable type:
sudo amixer cset numid=3 2
This step is only required if you are finding a black border
around the edge of your screen or the image overlaps the
screen.
Or if you want sound through the analogue (headphone)
socket type:
sudo amixer cset numid=3 1
After booting up debian, login with
username: pi
password: raspberry
To make sure the sound driver module gets loaded each
time you boot up type:
sudo nano /etc/modules
At the pi@raspberrypi:~$ prompt, type in:
sudo nano /boot/config.txt
At the bottom of the file add the following:
snd_bcm2835
Type the following into the nano text editor:
overscan_left=-10
overscan_right=-10
overscan_top=-10
overscan_bottom=-10
Press Ctrl+X and then Y to save the changes.
Reboot the Pi:
sudo reboot
Press Ctrl+X to Exit and Y to say Yes to saving the
changes.
Login and start the LXDE Graphical Interface by typing:
startx
When you are back at the command prompt type:
sudo reboot
When LXDE has loaded, select 'Music Player' (LXMusic)
from the Sound & Video menu . Press the Play button. If all
is well you should hear a 40 second piece of music called
'Cellule' by Silence.
Wait for the Pi to reboot and see if the borders have gone.
Repeat the process above changing the numbers by
minus 10 each time until the border is gone. I found that
my HDMI monitor required -40 for all settings, but my TV
worked best with zero for left and right and -20 for both
top and bottom. You will need to find the best settings to
suit your particular screen. If the picture goes off the edge
of the screen, just use positive numbers for the overscan
values.
You can use the File Manager to copy MP3 music from a
USB memory stick into your home folder or play them
directly through Music Player. Note, however, that it won't
play WMA files.
FIXING GEANY (Python Editor)
When trying to execute Python scripts from Geany you will
get an error.
IF AFTER REBOOTING YOU ARE GETTING NO PICTURE:
You can reset the settings back to default by typing
blindly:
pi
raspberry
sudo rm /boot/config.txt -R
sudo reboot
To resolve this, go to Edit>Preferences>Tools.
Change the 'Terminal:' setting from 'xterm' to
'/usr/bin/lxterminal'.
Click Apply and OK.
This will remove the config.txt file completely. After the
reboot your picture should return. Try setting your
overscan again with slightly lower numbers until you find
the best values.
INSTALLING OMXPLAYER (Command Line
Movie Player)
The OMXPlayer will allow you to play AVI and MP4 movies
on your Raspberry Pi.
Alternatively, if you have a Windows PC and a card reader
you can access the config.txt file and edit it with the
Windows Notepad program.
At the command prompt type:
sudo apt-get install omxplayer
4
1150080069.011.png 1150080069.012.png 1150080069.013.png 1150080069.014.png 1150080069.015.png
Use File Manager to copy some movie files from a USB
device into your home folder then from the command
prompt type:
omxplayer filename
openoffice.org Office Productivity Suite
oxine Media Center for MPEG, MP3 and WMA
qrencode QR Code encoder>PNG image (Type qrencode
<string> -o filename)
schism ImpulseTracker Clone
scribus Desktop Publishing (Used to produce The MagPi)
ghostscript PostScript/PDF interpreter (Use with Scribus)
tuxpaint A Paint Program For Young Children
xball Simulate bouncing balls in a window (Click and drag
in the window)
xchat IRC Chat Client
xcircuit Electrical Diagram Package
xine-ui Media Player for MPEG, MP3 and WMA
xpad Sticky Note Application
xpaint Simple Paint Program
xtrkcad Model Train Track CAD Program
yakuake A terminal window drops down from the top of
the screen when you press F12.
While playing press 'p' to pause and 'q' to quit. Use arrow
keys to jump forward/back.
INSTALLING CHROMIUM WEB BROWSER
Chromium is slow on the Pi, but it works well with the
following useful websites:
http://qwebirc.swiftirc.net - instant messenger chat rooms
http://www.dropbox.com - upload/download/share/transfer
http://www.gmail.com in Basic HTML mode - send/receive
Google email with attachments
sudo apt-get install chromium-browser
INSTALLING XPDF
3dchess Game (3x2d boards)
abe Abe's Amazing Adventure Game
ace-of-penguins Freecell, Solitaire+ Minesweeper, Teipei...
airstrike 2D Airplane Dogfighting Game
atom4 Color Puzzle Game
atris Tetris game
balazar3-2d Cool 3D Game
beneath-a-steel-sky Sci-fi Adventure Game (Nice Intro!)
blobwars Metal Blob Solid - Amazing 2D Platform Game
blockade Puzzle Game - command line 'sudo blockade'
bumprace 2D Space Maze Game
bygfoot Football Manager Game
ceferino Don Ceferino Hazaa Platform Game
childsplay Interactive Childrens Games Collection
crimson Crimson Fields Tactical Game
dangen Strange Shoot 'Em Up Game
dodgindiamond2 Arcade Shoot 'Em Up (Press M for Fire)
dossizola Isola Board Game
empire Text-Only Empire Building Game
enigma Puzzle Game
etw Eat The Whistle Football Arcade Game
fillets-ng Fish Fillets Puzzle Game
flobopuyo Connect4 meets Tetris
freealchemist Block Game
freedink RPG (Use GNU Free Dink from Other)
freedroid Paranoid Game Clone
frozen-bubble Frozen Bubble 2 Game
geki2 Xenon-like vertical shoot'em up (Fantastic!)
geki3 R-Type-like horizontal shoot'em up (Amazing)
ghextris A Tetrissudo-like Game On A Hexagonal Grid
glotski Slide Blocks To Reach A Goal
glpeces Tangram Puzzle Game Clone
gmchess Chinese Chess Game (Xiangqi)
gnugo The Game Of 'Go'
gnujump Plaftorm Game
gnuminishogi Mini Shogi 5x5 Board (Type 'help')
golly Game of Life Simulator
gravitywars Gravity Force Clone
grhino Othello/Reversi Board Game
groundhog Simple Logic Game
gtans Tangram Puzzle Game
gtkatlantic Game Like Monopoly
gtkballs Logic Game
gtkboard Many Board Games In One Program
XPDF is a free PDF document viewer.
Download The MagPi PDF files by opening the Midori web
browser and visiting http://www.themagpi.com. Click on
one of the PDF download mirrors. Choose 'Save' and
watch the progress of the download at the bottom right of
the browser.
At the command line, type:
ls (check that The MagPi Issue X Final.pdf is listed)
sudo apt-get install xpdf (Type Y if asked about space)
xpdf "The Magpi Issue 1 Final.pdf" (Wait a moment and
the PDF document should be displayed)
OTHER APPS AND GAMES
NOTE: Some of these get listed under 'Other' in
the LXDE menu.
To install use: sudo apt-get install <name>
To uninstall: sudo apt-get remove <name>
To clean up: sudo apt-get autoremove
abiword Word Processor
amsn MSN Messenger (Slow to open/close but works)
audacity Audio Editor / Player
avifile-player Useless for video but plays WMA+MP3 music
brandy BBC BASIC V Programming (Type 'brandy')
bwbasic Bywater BASIC Programming (Type 'bwbasic')
espeak Command Line Text2Speech Synth
evolution Email Calendar Contacts Memos Tasks
extcalc Powerful Scientific Calculator
feh Command Line Image Viewer (With many options)
filezilla FTP file sharing client
fotoxx Photo Editor
fraqtive Mandelbrot Designer
galculator Calculator
gimp GNU Image Manipulation Program
gnumeric Spreadsheets
gpaint MS Paint-like drawing
grafx2 256-Color Paint Program
grisbi Personal Finance Management Program
homebank Manage Personal Accounts At Home
lifeograph Private digital diary
matchbox On-screen Keyboard
mc Midnight Commander - terminal file manager (Type
'mc')
milkytracker Music creation tool inspired by Fast Tracker 2
mtpaint Powerful Graphic Editor
Continuedoverpage...
5
1150080069.016.png 1150080069.017.png 1150080069.018.png 1150080069.019.png
Zgłoś jeśli naruszono regulamin