
Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level Second Edition ■ ■ ■ Michael Gasperi and Philippe “Philo” Hurbain Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level, Second Edition Copyright © 2009 by Michael Gasperi and Philippe “Philo” Hurbain All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2453-2 ISBN-13 (electronic): 978-1-4302-2454-9 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the US and other countries. Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book was written without endorsement from Sun Microsystems, Inc. Lead Editor: Tony Campbell Technical Reviewer: Philippe “Philo” Hurbain Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Managers: Beth Christmas and Debra Kelly Copy Editor: Nancy Sixsmith Compositor: LaurelTech Indexer: Carol Burbo Artist: April Milne Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. This book is rededicated to my dear wife, Jayne. Thanks for putting up with the mess I made on your desk . again. —Love, Mike I dedicate this book to my wife, Annie. She puts up with the pervasive invasion of LEGO and electronics parts everywhere, as well as with LEGO models “decorating” most of the shelves of our home. —Thanks and love, Philo Contents at a Glance ■ Chapter 1: In the Beginning ........................................................................................ 1 ■ Chapter 2: Extreme Software ................................................................................... 21 ■ Chapter 3: Making a Connection .............................................................................. 47 ■ Chapter 4: Contact Sensors ...................................................................................... 63 ■ Chapter 5: Resistive Sensors .................................................................................... 73 ■ Chapter 6: Potentiometer Sensors .......................................................................... 103 ■ Chapter 7: Voltage Sensors .................................................................................... 119 ■ Chapter 8: 4.3V Powered Sensors .......................................................................... 127 ■ Chapter 9: Two-Wire Powered Sensors .................................................................. 145 ■ Chapter 10: Light Sensor with LED Control............................................................. 165 ■ Chapter 11: LEGO Motor Interfaces ........................................................................ 173 ■ Chapter 12: Beyond LEGO Motors ........................................................................... 195 ■ Chapter 13: I2C Bus Communication ....................................................................... 229 ■ Chapter 14: Cool Combinations .............................................................................. 267 ■ Appendix A: Construction Techniques .................................................................... 291 ■ Appendix B: References, Links, and Sources ......................................................... 309 ■ Appendix C: Code Listings ...................................................................................... 315 ■ Index ....................................................................................................................... 327 v ■ CONTENTS Contents Contents at a Glance ....................................................................................................... v Contents ....................................................................................................................... vii Foreword ..................................................................................................................... xiii About the Authors ......................................................................................................... xv Acknowledgments ...................................................................................................... xvii Introduction ................................................................................................................. xix ■ Chapter 1: In the Beginning ........................................................................................ 1 The RCX and the Robotics Invention System ..................................................................... 2 The MINDSTORMS NXT ...................................................................................................... 3 The Sensors ....................................................................................................................... 5 The NXT Motor ................................................................................................................. 19 ■ Chapter 2: Extreme Software ................................................................................... 21 NXT-G ............................................................................................................................... 21 Not eXactly C and Bricx Command Center ....................................................................... 37 Other Alternative Languages ........................................................................................... 45 ■ Chapter 3: Making a Connection .............................................................................. 47 NXT Ports ......................................................................................................................... 47 Physically Connecting to the NXT .................................................................................... 52 vii ■ CONTENTS Screw Terminal for Passive Sensors ............................................................................... 60 ■ Chapter 4: Contact Sensors ...................................................................................... 63 Touching Wires ................................................................................................................ 63 Electronic Surfboard ........................................................................................................ 64 Construction .................................................................................................................... 64 Switches .......................................................................................................................... 66 Parallel and Series ........................................................................................................... 67 Antenna Sensor ............................................................................................................... 67 Going Further ................................................................................................................... 72 ■ Chapter 5: Resistive Sensors .................................................................................... 73 Analog-to-Digital Conversion ........................................................................................... 73 Ohmmeter ........................................................................................................................ 75 Legacy Temperature Sensor ............................................................................................ 78 Light Sensor ..................................................................................................................... 89 Two-Switch Input ............................................................................................................ 99 ■ Chapter 6: Potentiometer Sensors .......................................................................... 103 Connecting to the Pot ...................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages350 Page
-
File Size-