Adventures In Raspberry Pi
Carrie Anne Philbin
Format: PDF / Kindle (mobi) / ePub
Coding for kids is cool with Raspberry Pi and this elementary guide
Even if your kids don't have an ounce of computer geek in them, they can learn to code with Raspberry Pi and this wonderful book. Written for 11- to 15-year-olds and assuming no prior computing knowledge, this book uses the wildly successful, low-cost, credit-card-sized Raspberry Pi computer to explain fundamental computing concepts. Young people will enjoy going through the book's nine fun projects while they learn basic programming and system administration skills, starting with the very basics of how to plug in the board and turn it on.
Each project includes a lively and informative video to reinforce the lessons. It's perfect for young, eager self-learners—your kids can jump in, set up their Raspberry Pi, and go through the lessons on their own.
- Written by Carrie Anne Philbin, a high school teacher of computing who advises the U.K. government on the revised ICT Curriculum
- Teaches 11- to 15-year-olds programming and system administration skills using Raspberry Pi
- Features 9 fun projects accompanied by lively and helpful videos
- Raspberry Pi is a $35/£25 credit-card-sized computer created by the non-profit Raspberry Pi Foundation; over a million have been sold
Help your children have fun and learn computing skills at the same time with Adventures in Raspberry Pi.
open the text editor, click File➜New Window from the menu at the top of the Python 3 interpreter or shell. Type in all the code that you typed into the interpreter in the preceding section, and save the new file to your Documents directory on your Raspberry Pi as FirstTurtle.py (see Figure 4-11). You can run the script by clicking Run➜Run Module from the text editor toolbar. FIGURE 4-11 Using 90 the text editor to create and save files ADVEN T URES IN RASPBERRY PI You should use the text
Raspberry Pi Foundation. All other trademarks are the property of their respective owners. John Wiley & Sons, Ltd. is not associated with any product or vendor mentioned in the book. A catalogue record for this book is available from the British Library. ISBN 978-1-118-75125-1 (paperback); ISBN 978-1-118-75123-7 (ePub); ISBN 978-1-118-75122-0 (ePDF) Set in 10/12.5 Chaparral Pro Light by Indianapolis Composition Services Printed in the United Kingdom at Bell & Bain For Mum & Dad—my best
Pins on the Raspberry Pi THE GENERAL PURPOSE INPUT OUTPUT (GPIO) pins on the Raspberry Pi are what make it really special. The behaviour of these pins can be controlled or programmed— by you! You can use the pins to sense and control physical objects in the real world, like lights and switches. The pins are located on the main board of the Raspberry Pi, shown in Figure 8-1. In this adventure, you’ll learn some basics of electronics and then discover how to output to a light-emitting diode (LED),
ADVEN T URES IN RASPBERRY PI DIGGING INTO THE CODE You might be wondering about the setmode and BCM in the first line of the Step 2. There are two ways—modes—of numbering the GPIOs within RPi. GPIO—BCM and BOARD. It is important that you set the mode (setmode) you wish to use in your Python code. BOARD means that the numbers passed into the GPIO functions refer to the pin numbers of the header on the Raspberry Pi. BCM means that numbers passed into the GPIO functions refer to what the BroadCoM
website at www.wiley.com/go/adventuresinrp. Creating the buttonLED Python Code In Python IDLE 3, amend your LEDblink program to include the following lines (highlighted in bold): import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) import time GPIO.setup(23, GPIO.OUT) GPIO.setup(24, GPIO.IN) CHALLENGE Why did you add time.sleep(0.1) to the while loop in the buttonLED.py program? What might happen if you remove it? Have a go to find out! 184 ADVEN T URES IN RASPBERRY PI As before, you will set a