Home Page Icon
Home Page
Table of Contents for
III. Programming
Close
III. Programming
by Laurens Valk, David J. Perdue
The Unofficial LEGO MINDSTORMS NXT 2.0 Inventor's Guide, 2nd Edition
The Unofficial LEGO® MINDSTORMS® NXT 2.0 Inventor’s Guide
Dedication
Praise for the First Edition of The Unofficial LEGO® MINDSTORMS® NXT Inventor’s Guide
About the Author
About the Robot Builder
Technical Reviewers for the First Edition
Acknowledgments
Introduction
About this Book
Part I: Introduction to LEGO MINDSTORMS NXT 2.0
Part II: Building
Part III: Programming
Part IV: Projects
Companion Website
I. Introduction to LEGO MINDSTORMS NXT 2.0
1. LEGO MINDSTORMS NXT 2.0: People, Pieces, and Potential
Building a Robot
Programming a Robot
Activating a Robot
What Can I Create with My NXT 2.0 Set?
Conclusion
2. Getting Started with the NXT 2.0 Set
Requirements
Six AA Batteries
A PC or Mac
Bluetooth Technology (Optional)
Getting a Quick Start
Installing the NXT Software
Using the NXT Software
Getting Started with NXT-G
Creating a New NXT-G Program
Adding a Programming Block
Establishing a Connection with the USB Cable and Downloading a Program
Establishing a Connection with Bluetooth Technology and Downloading a Program
The Robo Center
My Portal
Organizing the Pieces
Conclusion
II. Building
3. Understanding the Electronic Pieces
The NXT
Output (Motor) Ports and the USB Port
The Input (Sensor) Ports
Bluetooth Capability
A Loudspeaker
Buttons and the LCD
The Servo Motors
The Sensors
Passive Sensors
The Touch Sensor
Digital Sensors
The Color Sensor
The Ultrasonic Sensor
Connecting the Electronic Pieces with Electrical Cables
Getting NXTreme
Conclusion
4. Understanding the LEGO MINDSTORMS NXT 2.0 Pieces
Introduction to the Pieces
Classifying the Pieces
Naming the Pieces
Measuring the Pieces
Examining the Pieces
The Electronics
The Beams
The Straight Beam
The Angled Beam
The Right-Angled Beam
The Connectors
The Axles
The Pegs
The Connector Blocks
The Gears
Bevel Gears
Double Bevel Gears
Other Gears
The Miscellaneous Elements
Conclusion
5. Building Sturdy Structures
Extending Beams
Widening Beams
Forming Corners
Creating Angled Structures
Creating Dynamic Structures
Creating Flexible Structures
Conclusion
6. Building with Gears
The Gear Train
Controlling a Gear Train’s Performance
The Gear Ratio
Gearing Down: More Torque and Less Speed
Gearing Up: More Speed and Less Torque
Compound Gearing: Achieving Greater Torque or Speed
Achieving Optimal Performance
Assembling LEGO Gear Trains
Spacing Gears on Parallel Axles
Spacing Gears on Perpendicular Axles
Conclusion
III. Programming
7. Introduction to NXT-G
Starting an NXT-G Program
The NXT-G Interface
The Menu Bar
The Toolbar
The Work Area
The Programming Palette
The Configuration Panel
The Controller
The Little Help Window and the Work Area Map
Fundamental NXT-G Concepts
The Starting Point
Sequence Beams
Extending the Sequence Beam
Parallel Sequence Beams
Automatic Resizing of Sequence Beams
Managing Programming Blocks in the Work Area
Navigating the Work Area
Increasing Program Readability with Comments
The Common Palette
The Move Block
The Port Parameter
The Direction Parameter
The Steering Parameter
The Power Parameter
The Duration Parameter
The Next Action Parameter
Feedback Boxes
The Record/Play Block
The Sound Block
The Display Block
The Wait Block
The Loop Block
The Switch Block
Conclusion
8. Advanced NXT-G Programming
Data Wires
Data Plug Characteristics
The Wire Path
Transmitting the Data Types
Broken Data Wires
Data Type Mismatch
Missing Input
Too Many Inputs
The Complete Palette
The Common Blocks
The Action Blocks
The Motor Block
The Sound Block
The Display Block
The Send Message Block
The Color Lamp Block
The Sensor Blocks
The Flow Blocks
The Data Blocks
The Logic Block
The Math Block
The Compare Block
The Range Block
The Random Block
The Variable Block
The Constant Block
The Advanced Blocks
The Number to Text Block
The Text Block
The Keep Alive Block
The File Access Block
The Calibration Block
The Reset Motor Block
The Bluetooth Connection Block
The Custom Palette
The My Blocks
The Web Blocks
Conclusion
9. NXT-G Tools
Calibrate Sensors
Update NXT Firmware
Create Pack and Go
Block Import and Export Wizard
Image Editor
Remote Control
Sound Editor
Conclusion
IV. Projects
10. The MINDSTORMS Method
Hitting the Target with the MINDSTORMS Method
Step 1: Getting an Idea for a Robot
Step 2: Building the Robot
Step 3: Programming the Robot
Step 4: Documenting the Robot
Conclusion
11. Inventor-Bot: A Vehicle with Treads
Building Inventor-Bot
Connecting the Cables
Programming Inventor-Bot
Driving Straight and Turning
Making the Robot Interactive
Conclusion
12. Sentry-Bot: An Intruder Detector
Adding the Ultrasonic Sensor
Avoiding Objects
Following an Object in a Straight Line
The Shooter Extension
Testing the Shooter
Creating the Complete Sentry Program
Conclusion
13. Table-Bot: An Edge-Avoiding Robot
Creating the Antennae Attachments
Programming Table-Bot
Keeping Track of Events
Getting Out of Corners
Conclusion
14. The Jeep: A Front-Wheel Drive Vehicle
Understanding the Jeep Design
Steering with the Front Wheels
Driving with the Front Wheels
Moving Around with the Jeep’s Front-Wheel Drive
Understanding the Wheel Speeds
Calculating the Wheel Speeds
Building the Jeep
Programming the Jeep
Jeep Program Essentials
My Block #1: Center and Reset
My Block #2: Wheel Control
Testing the My Blocks
Creating the Wall-Avoidance Program
Following a Line
Line-Following Basics
Line Following with the Jeep
Creating the Line-Following Program
Further Explorations for the Jeep
Idea #1: Headlights
Idea #2: Remote Control
Idea #3: Parking Sensor
Conclusion
15. The Lizard: A Color-Sensitive Reptile
Understanding How the Lizard Walks
Using One Motor to Control Two Legs
Controlling Four Legs to Produce Walking
Making Turns
Building the Lizard
Building the Body
Attaching the Cables
Building and Attaching the Legs
Programming the Lizard
Synchronizing the Motors with Touch Sensors
Creating the My Blocks
My Block #1: Synchronize
My Block #2: Walk
Creating the Final Program
Step 1: The Structure of the Program
Step 2: Blue
Step 3: Green
Step 4: Red
Step 5: Yellow
Exploring the Lizard Further
Idea #1: More Behavior
Idea #2: Create Your Own Animal
Conclusion
16. The Printer: A Drawing Machine
Understanding How the Printer Works
Components of the Printer
Non-LEGO Requirements for the Printer
Building the Printer
Connecting the Cables
Programming the Printer
Creating the My Blocks
My Block #1: Liftpen
My Block #2: Lowerpen
My Block #3: ResetHorizontal
My Block #4: ResetVertical
My Block #5: Eject
My Block #6: Horizontal
My Block #7: Vertical
Testing and Troubleshooting the Printer
The Test Program
Troubleshooting the Printer
Creased or Crumpled Paper in the Machine
The Pen Doesn’t Write
The Pen Presses Too Hard
The ResetVertical My Block Doesn’t Work
The Cable for Motor a Snags the Paper
Creating the Final Program
Exploring the Printer Further
Idea #1: Progress Update
Idea #2: Morse Code
Idea #3: Data Logging
Conclusion
A. LEGO MINDSTORMS NXT 2.0 Piece Library
B. NXT-G 2.0 Quick Reference
C. Internet Resources
General Resources
Programming Resources
Bluetooth Resources
NXT Blogs
LEGO Computeraided Design Resources
Building Techniques
Educational Resources
Buying LEGO
LEGO Storage
Personal Websites
LEGO Events
Index
About the Authors
Copyright
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
6. Building with Gears
Next
Next Chapter
7. Introduction to NXT-G
Part III. Programming
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset