- ホーム
- > 洋書
- > 英文書
- > Computer / General
Full Description
Start programming quickly with this super-fun guide to Raspberry Pi Adventures in Raspberry Pi, 2nd Edition includes 9 cool projects that show you how to set up and start developing on your Raspberry Pi. Updated for the release of the Rev 3 board, this second edition covers all the latest features and tells you everything you need to know. Written specifically for 11-15 year-olds, this book uses the wildly successful, Raspberry Pi to explain the fundamentals of computing. You'll have a blast learning basic programming and system administration skills, beginning with the very basics of how to plug in the board and turn it on. Each project includes an instructional video so you can jump right in and start going through the lessons on your own.This hands-on book gets you up and running fast, with fun projects that let you explore.Learn how to "talk to" your Raspberry PiCreate games and stories with ScratchProgram with Turtle Graphics and PythonCode music and create a Raspberry Pi jukeboxIf you want to get started programming today, Adventures in Raspberry Pi is the ultimate hands-on guide.
Contents
About the Author vAcknowledgments viIntroduction 1Adventure 1 You Have a Raspberry Pi Now What? 9What Hardware Do You Need? 10What Other Equipment Is Helpful? 12Setting Up the Raspberry Pi 14Downloading and Copying the Raspbian Operating System 14Preparing an SD Card to Store Your Software 15Making It Easy with NOOBS 17Plugging in the Hardware 18Installing and Configuring the Software 19Logging in to Your Raspberry Pi 22Exploring the Desktop in Raspbian 23Shutting Down Your Raspberry Pi 25Backing up an SD Card Image 25Adventure 2 Taking Command of Your Raspberry Pi 27Exploring the Terminal 29Commands for Navigating Through Your File System 31Understanding sudo 35Launching Programs from the Command Line 35Managing Files and Directories 36Installing and Updating Applications 37Downloading and Installing Applications 37Learning More About an Application 38Upgrading Your Apps 39Editing Files 39Using Shutdown and Restart Commands 41Continuing Your Text Adventure 41Adventure 3 Creating Stories and Games with Scratch 45Getting Started with Scratch 46The Scratch Interface 47A Quick Hello from Scratch Cat 48Setting the Stage 50Creating Costumes and Original Sprites 52Using the Scratch Sprite Image Library 52Editing an Existing Sprite 52Creating Your Own Original Sprites 53Animating a Crazy Monkey 53Creating an Adventure Role-Playing Game 59Creating Your Sprite and Stage 59Setting the Start Position of the Adventurer Sprite 60Creating Variables: Including Health Points for the Adventurer Sprite 61Controlling the Direction and Movement of the Adventurer Sprite 63Entering a Cave and Switching Backgrounds 64Adding a Script to Make the Adventurer Sprite MoveBetween Backgrounds 64Adding a Script to Switch the Stage 66Creating an Enchanted Key to Exit the Cave and Giving ExtraHealth Points 67Using "if" Statements to Show and Hide Sprites 69Creating Health-Point-Stealing Sprites 70Improving the Movement of the Adventurer Sprite Using "if" Blocks 71Creating a Game Over Screen 72Ideas for Improvements to Your Game 73Adventure 4 Programming Shapes with Turtle Graphics 77Scratch Turtle Graphics 78Using Pen Down and Pen Up 79Drawing Simple Shapes 80Using "clear" and Setting a Start Point 82Using Variables Instead of Values 82Changing the Size and Colour of the Pen 83Creating Spiral Patterns 84Using User Input to Determine the Number of Sides 86Python Turtle Graphics 86Introducing Python Modules 87The IDLE Environment and the Interpreter Window 87Using the Turtle Module in Python 88Using a Text Editor 90Using "for" Loops and Lists 91The "range" Function 93Other Python Turtle Module Commands 94Pen Up and Pen Down 94Setting the Pen Colour and Size 95Stamping 95Some Super Spirals 95Further Adventures with Python Turtle 97Adventure 5 Programming with Python 101Getting Set Up for Python 102Python Programming Language 102The IDLE Environment 102Programming in Python: Using a Function 103Using a Text Editor to Create a Code File 106Using the Python time and random Modules 108Python Text Adventure Game 112Getting User Input 112Using Conditionals 113Using a while Loop 116Using a Variable for Health Points 118Putting It All Together 119Defining Functions 121The get-input Function 121The handle-room Function 122Creating a Main Game Loop 122Continuing Your Python Adventure 126Adventure 6 Programming Minecraft Worlds on the Raspberry Pi 129Getting Started with Minecraft Pi 130Minecraft Pi Controls 132Your First Minecraft Pi Python Program 133Using Coordinates in Minecraft Pi 135Finding the Player s Location 135Changing the Player s Location 137Placing a Block 138Placing Multiple Blocks 139Creating a Diamond Transporter 142Sharing and Cloning Minecraft Pi Programs 145Further Adventures with Minecraft Pi 146Adventure 7 Coding Music with Sonic Pi 149Getting Started with Sonic Pi 150The Sonic Pi Interface 151Creating Your First Sounds with Sonic Pi 153Twinkle Twinkle Little Star 155Repeating Lines in a Loop 158First Electronic Track 160Using Different Synthesizer Sounds 160Using Prerecorded Samples 161Creating a Surprising Tune 163Using "rand" to Play Random Notes 163Using Algorithms 164Running Two Scripts at the Same Time 166Adding Effects 167Make a Recording of Your Music 167Further Adventures with Sonic Pi 168Adventure 8 Using the GPIO Pins on the Raspberry Pi 171Using a Raspberry Leaf Diagram 172Electronic Basics 175Using the Python Library to Control GPIO 177Do You Have a Rev 1 or a Rev 2 Board? 177Making an LED Blink 179Creating the LEDblink Python Code 180Connecting the LEDblink Components 181Running LEDblink.py as the Super User root 182Using a Button to Turn on an LED 184Creating the buttonLED Python Code 184Connecting the buttonLED Components 185Running buttonLED.py as the Super User root 186The Marshmallow Challenge 187Creating the Marshmallow Button 188Mapping Marshmallow Input to a Keyboard Key 190Scratch Marshmallow Game 192Further Adventures with GPIO Pins 195Adventure 9 The Big Adventure: Building a Raspberry Pi Jukebox 197An Overview of the Jukebox Project 198What You Will Need 199Part One: Creating the LCD Screen 200Preparing the LCD Screen by Adding Headers 200Mounting the LCD Screen and Wiring Up the Breadboard 201Adding Scripts to Drive the LCD Screen 203Part Two: Downloading and Playing MP3s 205Installing a Media Player and Getting Music Files 205Writing a Jukebox Python Program 208Part Three: Controlling the Jukebox with Buttons 212Connecting the Buttons 212Adapting Your Jukebox Program to Include GPIO Buttons 214Part Four: Displaying Jukebox Information on the LCD screen 216Finishing Up 221Appendix Where to Go from Here 223Websites 223Clubs 225Inspiring Projects and Tutorials 226Videos 226Books and Magazines 227Glossary 229Index 235