Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
The Art of LEGO® MINDSTORMS® NXT-G Programming
acknowledgments
introduction
who this book is for
prerequisites
what to expect from this book
how best to use this book
1. LEGO and robots: a great combination
LEGO MINDSTORMS NXT
the NXT online community
the LEGO MINDSTORMS NXT kit
NXT versions
MINDSTORMS software versions
version 1.0/1.1
education 2.0
retail 2.0
art and engineering
qualities of a good program
software, firmware, and hardware
NXT-G
what you’ll learn from this book
what’s next?
2. the NXT-G programming environment
a tour through the MINDSTORMS environment
a: work area
b: programming palettes
c: robo center
d: my portal window
e: configuration panel
f: help panel
g: navigation panel
h: controller
writing an NXT-G program
your first program
saving your work
running your program
your second program
debugging
reproduce the bug
simplify the program
look at the parts of the program
fix the bug
the edit-compile-test cycle
comments
adding comments
the program description
the comment tool
rules for working with comments
the configuration panel
general layout
changing panels
disabled items
a block’s configuration icons
conclusion
3. the test robot
right-side motor
left-side motor
chassis
caster wheel
caster wheel for the NXT 2.0 retail kit
caster wheel for the original NXT retail kit and education set
attach the caster wheel
add the NXT
touch sensor bumper
attach the bumper to the chassis
ultrasonic sensor
sound sensor
color sensor or light sensor
attach the wires
the final beam
alternate placement for the color sensor
alternate placement for the ultrasonic sensor
conclusion
4. motion
the NXT motor
the move block
the move block’s configuration panel
port
direction
power
duration
steering
next action
the feedback boxes
the NXT intelligent brick view menu
there and back
moving forward
turning around
testing a single block
moving back to the start
around the block
the first side and corner
the other three sides and corners
testing the program
the motor block
brake, coast, and the reset motor block
the CoastTest program
a problem with coasting
observing the problem
the reset motor block
the record/play block
configuration panel
the remote control tool
conclusion
5. sensors
using the sensors
the touch sensor
configuration panel
feedback box
the NXT’s view menu
the BumperBot program
detecting an obstacle
backing up and turning around
testing
the sound sensor
configuration panel
setting the trigger value
BumperBot with sound
the light and color sensors
light sensor configuration panel
using the color sensor as a light sensor
the RedOrBlue program
determining red and blue values
the switch block
improving the program
using the touch sensor
adding a loop
using color sensor mode
the ultrasonic sensor
configuration panel
door chime
detecting a person
playing a chime
stopping the chime
the rotation sensor
configuration panel
the rotation sensor block
the BumperBot2 program
conclusion
6. program flow
the sequence beam
the switch block
configuration panel
the control setting
the sensor setting
setting the condition
the display setting
the LineFollower program
the basic program
selecting the light sensor trigger
configuring the move blocks
testing the program
more than two choices
setting the trigger values
testing the program
using tabbed view
comments and tabbed view
the loop block
the keep alive block
the stop block
BumperBot3
conclusion
7. the WallFollower program: navigating a maze
pseudocode
solving a maze
program requirements
assumptions
initial design
following a straight wall
writing the code
testing
turning a corner
writing the code
testing
going through an opening
writing the code
using sound blocks for debugging
testing
final test
conclusion
8. data wires
what is a data wire?
the GentleStop program
tips for drawing data wires
the SoundMachine program
controlling the volume
using the math block
adding tone control to the SoundMachine program
understanding data types
using the number to text block
displaying the tone frequency
using the text block
adding labels to the displayed values
dealing with broken wires
conclusion
9. data wires and the switch block
the switch block’s value option
rewriting the GentleStop program
advantages of using a sensor block
passing data into a switch block
passing data out of a switch block
matching more than two values
adding and removing conditions
the default condition
using numbers with the NXT-G 2.0 switch block
fixing the SoundMachine program’s volume display
calculating the input value using NXT-G 1.1
calculating the input value using NXT-G 2.0
modifying the program
conclusion
10. data wires and the loop block
the loop count
creating the LoopCountTest program
restarting a loop
setting the final loop count value
setting the loop condition
timers
the timer block
a programmable timer, version 1
the compare block
a programmable timer, version 2
a programmable timer, version 3
conclusion
11. variables
a place for your data
managing variables
the variable block
the RedOrBlueCount program
creating the variables
initializing the variables
initializing the display
displaying the initial values
counting the red objects
counting the blue objects
grouping common settings
replacing long data wires with variables
the LightPointer program
defining the variables
finding the light source
initializing the values
the LightPointer program, part 1
finding the light source
stopping the motors
the LightPointer program, part 2
constants
managing constants
the constant block
choose from list
custom
working with custom constants
conclusion
12. the NXT buttons and the display block
the NXT buttons
the NXT button block
the PowerSetting program
defining the variable
the initial value and the loop
displaying the current value
adjusting the power value
testing the program
making the program faster
the display block
displaying an image
power setting with images
displaying the snail and rabbit
display the arrow
drawing on the screen
the NXTSketch program
defining the variables
initialization
drawing the line
saving the new location
testing the program
fixing the dials for NXT-G 2.0
conclusion
13. my blocks
building bigger blocks
creating a my block
the custom palette
editing a my block
configuring a my block
changing the name of a configuration item
the DisplayNumber block
configuration items
controlling the line setting using a data wire
building the DisplayNumber block
testing
creating the DisplayNumber block
changing the names of the configuration items
using the DisplayNumber block
managing the custom palette
sharing programs with my blocks
copying files
create pack and go
advanced my block topics
variables and my blocks
nesting my blocks
broken my blocks
adding a data plug
conclusion
14. math and logic
computer math
integer math
range of values
division
order of operations
scaling values
odometer
floating-point math
range
precision
the number to text block
the random block
adding a random turn to BumperBot
the logic block
adding some logic to BumperBot
the range block
improving RedOrBlue
improving RedOrBlueColorMode
conclusion
15. files
using files
the file access block
the filename
the action setting
the type setting
saving the RedOrBlueCount data
checking for errors
the FileReader program
restoring the RedOrBlueCount data
managing memory
deleting files
transferring files
common problems
conclusion
16. data logging
data collection and the NXT
the VerifyLightPointer program
collecting the brightness data
running the program
analyzing the data
adding rotation sensor data and a timestamp
gaps in the data
setting the initial file size
controlling the amount of data
data logging using the LEGO MINDSTORMS education NXT software 2.0
the data-logging blocks
the VerifyLightPointer2 program
the NXT data logging application
conclusion
17. using multiple sequence beams
multitasking
adding a second sequence beam
avoiding a busy loop
adding a sequence beam to a loop block
the crowbar and pin technique
adding the sequence beam
expanding the loop block
making the light flash
understanding program flow rules
starting blocks and data wires
starting a loop or switch block
using values from a loop or switch block
using my blocks
synchronizing two sequence beams
the AroundTheBlock program
the DoorChime program
keeping out of trouble
conclusion
18. the LineFollower program
following a line
requirements
assumptions
the starting point
selecting the sensor trigger values
building the LineFollowerConfig program
testing the LineFollowerConfig program
changing the LineFollower program
reading the high and low values
calculating the trigger values
using the trigger values
testing the LineFollower program
adding a pause at the beginning of the program
improving the control algorithm
how far from the edge?
understanding the error value
using percent error
setting the range value
calculating the error value
controlling the motors
using the motor block
setting the power values
understanding the process
a few examples
writing the code
initializing the gain and power variables
testing the program
conclusion
A. NXT websites
B. moving from NXT-G 1.0/1.1 to NXT-G 2.0
numbers
block changes
using old programs
side-by-side installation
Index
About the Author
updates
← Prev
Back
Next →
← Prev
Back
Next →