4,99 €
Raspberry Pi is a UK Non Profit with the goal of creating a new generation of computer programmers. Observing how the UK Tech Industry was kickstarted by the availability in the 1980s of relatively cheap, very programmable computers such as the ZX81, the Commodore and the BBC Micro, the Raspberry Pi Foundation designed a £15/$25 computer which encourages the user to play and to learn. Although intended for schools, it has also been adopted by hackers and geeks, and a whole ecosystem of software and hardware is being built around the Pi. With a million boards now sold, the goal of the Foundation is well underway.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 163
Veröffentlichungsjahr: 2013
Raspberry Pi® Hardware Projects, Volume 2
This edition first published 2014
© 2014 John Wiley & Sons, Ltd.
Registered office
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offices, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com.
The right of the authors to be identified as the authors of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought.
Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley and Sons, Inc. and/ or its affiliates in the United States and/or other countries, and may not be used without written permission. Raspberry Pi is a trademark of the 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-58890-1 (ePub); ISBN 978-1-118-72390-6 (ePDF)
Set in Chaparral Pro Regular 10/12.5 by Indianapolis Composition Services
Table of Contents
Introduction
Chapter 1: Computer-Controlled Slot Car Racing
Obtaining a Slot Car Racer
Hacking Your Slot Car Racer
Testing Your Slot Car Racer Hack
Getting the Player Input
Making the Joystick Buttons
Boxing It Up
Joystick Testing
The Software
The Game
Over to You
Chapter 2: Facebook-Enabled Roto-Sketch
The Concept
Rotary Encoder Types
The Encoder Output
Posting to Facebook
Using Flickr
The Final Roto-Sketch Program
Creating a Symmetrical Pattern
Over to You
Chapter 3: The Pendulum Pi, a Harmonograph
The Concept
The Hall Effect
Enter the Arduino
Putting It Together
Smooth Swinging
Electronics
Programming the Arduino
The Final Arduino code
Programming the Pi
Using the Pendulum Pi
Over to You
Appendix A: Getting Your Raspberry Pi Up and Running
Getting the OS on an SD Card
Connecting a Display
Connecting to a Network
Booting the Operating System
Powering Up!
Common Problems
If You Need More Help
Appendix B: Introductory Software Project: The Insult Generator
Variables
Strings
Lists
Functions
Conditional Behaviour
Making Your Own Functions
Creating Loops
Introduction
You’ve got a Raspberry Pi — now what? This book has the answer; it’s packed full of fun Raspberry Pi projects to inspire you. From getting your Pi generating comedy insults, controlling slot cars and drawing roto-sketches to building your own harmonograph, prepare to be entertained and amazed by your credit card–sized computer.
One word of warning: After you start you might never stop! Electronics and coding can be addictive; who knows what you might go on to make with the skills you learn from this book.
Appendix A, “Getting Your Raspberry Pi Up and Running”, is a beginner’s guide to your first steps with the Raspberry Pi. If you’ve never coded before, Appendix B, “Introductory Software Project: The Insult Generator”, will get you started programming in Python. Chapter 1, “Computer-Controlled Slot Car Racing”, will get you wiring up a slot car game and using it to keep score in a two-player multiple-choice quiz. Chapter 2, “Facebook-Enabled Roto-Sketch”, will show you how to use rotary controls to draw elaborate designs and automatically post them to Flickr and on to Facebook. Chapter 3, “The Pendulum Pi, a Harmonograph”, shows you how to create a harmonograph for producing intricate patterns using an Arduino to help the Pi with real-time data gathering. Along the way you will pick up the skills you need to develop your own ideas to make projects work exactly how you want them to.
Building and making is incredibly rewarding and satisfying. We want to get more people of the world to become producers of technology rather than consumers. The projects in this book are starting points — step by step, they’re easy to follow so you can get results quickly. But then the real satisfaction can come, that which comes from making the project your own. At the end of each chapter there are ideas and suggestions to extend the project, together with background information to point you in the right direction. The real addictive fun begins when you see your own ideas become reality.
Welcome to the world of digital making.
Chapter 1
Computer-Controlled Slot Car Racing
In This Chapter
• Learn how to use your Raspberry Pi to enable and disable a slot car set.
• See how to make your own illuminated joystick pad.
• Discover how to use an external text file as a question bank.
• Understand the interactions between the software and hardware.
This project isa rather different twist on the multiple-choice quiz theme. Not only does it have a novel way of inputting answers, but it also has a rather novel way of keeping the score.
The idea is that you are going to hack into a slot car game and allow the Raspberry Pi to control when the game can be played. Then players can drive their cars for three seconds at a time, if they are the first to answer a question correctly. If they get the question wrong, their opponent gets the time. The game continues until one player crosses the finishing line after completing a set number of laps. The questions come from a plain text file and can be added to, or the subject of them changed. They are multiple-choice questions with four possible answers, and players indicate their answer by moving a special joystick button. The successful player’s joystick button will light up green, whereas the other player’s button will light up red.
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
