LEGO MINDSTORMS NXT-G Programming Guide (eBook)
336 Seiten
Apress (Verlag)
978-1-4302-2977-3 (ISBN)
James Kelly's LEGO MINDSTORMS NXT-G Programming Guide, Second Edition is a fountain of wisdom and ideas for those looking to master the art of programming LEGO's MINDSTORMS NXT robotics kits. This second edition is fully-updated to cover all the latest features and parts in the NXT 2.0 series. It also includes exercises at the end of each chapter and other content suggestions from educators and other readers of the first edition.
LEGO MINDSTORMS NXT-G Programming Guide, Second Edition focuses on the NXT-G programming language. Readers 10 years old and up learn to apply NXT-G to real-life problems such as moving and turning, locating objects based upon their color, making decisions, and much more. Perfect for for those who are new to programming, the book covers the language, the underlying mathematics, and explains how to calibrate and adjust robots for best execution of their programming.
- Provides programming techniques and easy-to-follow examples for each and every programming block
- Includes homework-style exercises for use by educators
- Gives clear instructions on how to build a test robot for use in running the example programs
Please note: the print version of this title is black & white; the eBook is full color.
James Floyd Kelly is a professional writer from Atlanta, Georgia. He has written numerous books on multiple subjects, including LEGO robotics, open source software, and building your own CNC machine as well as a 3D printer. He is the editor-in-chief of the number one MINDSTORMS NXT blog, The NXT Step (TheNXTStep.com), where he is joined by fellow NXT experts who share their knowledge and designs with other robot fans around the world.
James Kelly's LEGO MINDSTORMS NXT-G Programming Guide, Second Edition is a fountain of wisdom and ideas for those looking to master the art of programming LEGO's MINDSTORMS NXT robotics kits. This second edition is fully-updated to cover all the latest features and parts in the NXT 2.0 series. It also includes exercises at the end of each chapter and other content suggestions from educators and other readers of the first edition. LEGO MINDSTORMS NXT-G Programming Guide, Second Edition focuses on the NXT-G programming language. Readers 10 years old and up learn to apply NXT-G to real-life problems such as moving and turning, locating objects based upon their color, making decisions, and much more. Perfect for for those who are new to programming, the book covers the language, the underlying mathematics, and explains how to calibrate and adjust robots for best execution of their programming. Provides programming techniques andeasy-to-follow examples for each and every programming block Includes homework-style exercises for use by educators Gives clear instructions on how to build a test robot for use in running the example programs Please note: the print version of this title is black & white; the eBook is full color.
James Floyd Kelly is a professional writer from Atlanta, Georgia. He has written numerous books on multiple subjects, including LEGO robotics, open source software, and building your own CNC machine as well as a 3D printer. He is the editor-in-chief of the number one MINDSTORMS NXT blog, The NXT Step (TheNXTStep.com), where he is joined by fellow NXT experts who share their knowledge and designs with other robot fans around the world.
Contents at a Glance 5
Table of Contents 6
About the Author 16
About the Technical Reviewer 17
Acknowledgments 18
Introduction 19
CHAPTER 1 Robots and Programs 20
What Is a Robot? 20
What Is a Program? 20
Programs are for Humans Too 22
Programs are Merely Instructions 22
The Challenge of Programming 23
NXT-G 24
CHAPTER 2 Program Structure 29
What Do I Mean by Structure? 29
Planning Your Program’s Structure 29
Moving Into Real Code 31
Exercises 32
Exercise 2-1. Move One Object Nearer to Another 32
Exercise 2-2. Place Objects at Corners 32
What’s Next? 33
Exercise Solutions 33
Exercise 2-1 33
Exercise 2-2 33
CHAPTER 3 Hello World! 34
Programming the DISPLAY Block 34
Waiting for the Results 37
Doing More with DISPLAY 38
Understanding Data Hubs 40
Exercises 43
Exercise 3-1. Display Your Own Text 43
Exercise 3-2: Draw a Rectangle 43
What’s Next 44
Exercise Solutions 44
Exercise 3-1 44
Exercise 3-2 45
CHAPTER 4 Get Movin’ 48
The MOVE block 48
Moving Forward and Backward 49
Stopping 51
Steering 52
Power Settings 52
Duration Settings 53
Braking and Coasting 54
Exercises 55
Exercise 4-1. Drive in a Circle 55
Exercise 4-2: Make an “S” 56
What’s Next? 56
Exercise Solutions 56
Exercise 4-1 56
Exercise 4-2 57
CHAPTER 5 Record and Playback 59
The RECORD/PLAY Block 60
Recording Movement 61
Replaying Movement 62
Having Fun with Record/Play 63
Exercises 63
Exercise 5-1: Record a Cha-cha-cha Movement 63
Exercise 5-2: Roll Forwards and Backwards First 63
What’s Next? 64
Possible Solutions to Exercises 64
Exercise 7 64
Exercise 8 64
CHAPTER 6 Make Some Noise! 67
The SOUND Block 67
Action Settings 68
Sound File 68
Tone 68
Note Settings 69
Control Settings 69
Function Settings 69
Volume Settings 69
Wait Settings 70
Custom Sounds 72
Exercises 75
Exercise 6-1 75
Exercise 6-2 75
What’s Next? 75
Possible Solutions to Exercises 75
Exercise 6-1 75
Exercise 6-2 76
CHAPTER 7 Wired! 79
The Problem 79
A Simple Solution 80
The NXT-G Solution 81
An Example 85
Types of Data 87
Variables 88
A Real NXT-G Block 88
What’s Next? 90
CHAPTER 8 True or False? 91
One or the Other 91
Sensors: Yes or No 92
Variables and the Logic Type 93
Using Logic to Configure Settings 96
Exercise 11 98
What’s Next? 99
Exercise Solution 99
CHAPTER 9 Feedback 101
What’s Your Condition? 101
Configuring the Sensors 102
NXT Touch Sensor 103
RIS Touch Sensor 105
NXT Sound Sensor 106
NXT Light Sensor 106
RIS Light Sensor 107
NXT Ultrasonic Sensor 107
NXT Rotation Sensor 108
RIS Rotation Sensor 108
NXT Color Sensor 109
RIS Temperature Sensor 110
Other Input Types 110
Data Hub Power 112
Exercise 9-1 113
What’s Next? 114
Exercise Solution 114
CHAPTER 10 Wait for It! 116
The WAIT Block 116
The LIGHT SENSOR WAIT Block 119
The NXT BUTTONS WAIT Block 120
The ROTATION SENSOR WAIT Block 121
The SOUND SENSOR WAIT Block 121
The TIMER WAIT Block 122
The TOUCH SENSOR WAIT Block 122
The ULTRASONIC SENSOR WAIT Block 123
The COLOR SENSOR WAIT Block 124
Exercise 10-1 124
What’s Next 125
Exercise Solution 125
CHAPTER 11 Round and Round 128
Do It Again and Again and Again . . . 128
Nested Loops 136
Exercise 11-1 139
What’s Next? 143
Exercise Solution 143
CHAPTER 12 Decisions, Decisions 146
Left or Right? Door One or Door Two? 146
Flat and Tabbed Views 148
Choices 150
More Than Two Conditions 152
Default Decisions 157
Execution! 158
Exercise 12-1 Left or Right? 159
What’s Next? 159
Exercise Solution 159
CHAPTER 13 Stop It! 162
The STOP Block 162
A Looping Example 162
An Unconditional STOP 164
A SWITCH to a STOP 164
STOP for Testing 165
What’s Next? 166
CHAPTER 14 Pick a Card, Any Card 167
The RANDOM Block 167
The NUMBER TO TEXT Block 169
Exercise 14-1 173
What’s Next? 173
Exercise Solution 173
CHAPTER 15 Apples and Oranges 177
Logic 177
A Random Example 177
The COMPARE Block 180
The Display of Logic Values 183
A Test Run 186
Exercise 15-1 Happy or Sad 187
What’s Next? 187
Exercise Solution 188
CHAPTER 16 Inside or Out? 191
The RANGE Block 191
Exercise 16-1 Outside a Range 201
What’s Next? 201
Exercise Solution 201
CHAPTER 17 Yes? No? Maybe? 205
The LOGIC Block 205
Exercise 17-1: SPOT Finds a Spot 212
What’s Next? 212
Exercise Solution 212
CHAPTER 18 Title = Anything You Like 215
The VARIABLE Block 215
Exploring the VARIABLE Block 216
Reading from a VARIABLE 218
Writing to a VARIABLE 219
Storing Many Values 220
Solving the Example Problem 223
The CONSTANT Block 228
VARIABLE vs. CONSTANT 234
What’s Next? 234
CHAPTER 19 Basic Text 235
The TEXT Block 235
Exercise 19-1: Counting Characters 238
What’s Next? 239
Exercise Solution 239
CHAPTER 20 Basic Math 242
The MATH Block 242
Exercise 20-1: Calculate Total Degrees Traveled 245
What’s Next? 245
Exercise Solution 245
CHAPTER 21 Staying Alive 249
The KEEP ALIVE Block 249
Exercise 21-1: Loop Forever or Sleep? 251
What’s Next? 251
Exercise Solution 251
CHAPTER 22 Your Own Filing Cabinet 253
Introducing the FILE ACCESS Block 253
Exercise 22-1: Left, Right, Left 259
What’s Next? 259
Exercise Solution 259
CHAPTER 23 Calibration 265
The CALIBRATE Block 265
Put the CALIBRATE Block to Work 266
The Calibrate Sensors Tool 268
What’s Next? 270
CHAPTER 24 Motoring 271
The MOTOR Block 271
The RESET MOTOR Block 273
Exercise 24-1: True Readings 275
What’s Next? 275
Exercise Solution 276
CHAPTER 25 Messages 279
The BLUETOOTH CONNECTION Block 279
Some Preliminaries 279
Configuring a Connection 280
Initiating a Connection 282
Closing a Connection 283
The SEND MESSAGE Block 283
What’s Next? 288
CHAPTER 26 My Block Is Your Block 289
Creating a My Block 289
Exercise 26-1: The MyBlock Plug 296
You’re Ready to Go! 296
Exercise Solution 296
APPENDIX A Math Basics for NXT 301
Converting Between Degrees and Rotations 301
Converting Degrees and Rotations into Distances 302
The X/Y Coordinate System in NXT 303
APPENDIX B SPOT Building Instructions 305
APPENDIX C Image Editor 317
Opening an Image 317
Modifying an Image 319
Saving an Image 320
Using Your Image 321
Index 322
Erscheint lt. Verlag | 3.8.2010 |
---|---|
Zusatzinfo | 336 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Informatik ► Theorie / Studium ► Künstliche Intelligenz / Robotik |
Mathematik / Informatik ► Informatik ► Web / Internet | |
Informatik ► Weitere Themen ► Hardware | |
Technik ► Elektrotechnik / Energietechnik | |
Schlagworte | LEGO MINDSTORMS • Mindstorms • NXT-G • programming • Programming language • robot • Robotics |
ISBN-10 | 1-4302-2977-2 / 1430229772 |
ISBN-13 | 978-1-4302-2977-3 / 9781430229773 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 42,9 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich