Winning LEGO MINDSTORMS Programming by James J. Trobaugh & Mannie Lowe

Winning LEGO MINDSTORMS Programming by James J. Trobaugh & Mannie Lowe

Author:James J. Trobaugh & Mannie Lowe [Trobaugh, James J. & Lowe, Mannie]
Language: eng
Format: epub
Tags: Computers, Programming, General, Hardware
ISBN: 9781430245360
Publisher: Apress
Published: 2012-11-15T05:00:00+00:00


You can perform the calibration in two ways: by using NXT-G’s own Light Calibration block that stores the calibrated values in the NXT’s memory or by creating your own calibration program that stores the values locally in a file on the NXT.

NXT-G Calibration Block

In the NXT-G Advanced Tools menu, there is a Calibration block that is used to calibrate the maximum and minimum levels for both the NXT Light and Sound sensors. The values read by the Calibration block are stored on the NXT brick and remain until they are deleted or the sensors are recalibrated, even if the NXT brick has been turned off.

If you are using two NXT Light sensors on your robot, the calibration values stored by the Calibration block will be applied to both sensors. The NXT does not store separate values for each sensor.

To use the Calibration block, you simply add it to your NXT-G program. Most likely it is in a separate calibration program or at the beginning of the program that you are about to run. If you wish to include it in all of your programs and calibrate before each run, creating a MyBlock with your calibration code is a good idea. Be sure to verify with your event coordinator about when and where calibration is allowed.

You could create a My Calibration block, for example. Within this block, you would have to include two Calibration blocks—one to read the minimum light value and one to read the maximum light value—and some kind of trigger event, such as a Wait block, between the two Calibration blocks. For example, the first Calibration block reads the maximum light value, waits for the NXT orange button to be pressed, and then reads the minimum light value. When you first run this program, you hold the robot’s Light sensor over the lightest surface on the game field, preferably a part of the mat that is white (or a very light color). Next, you move the robot’s Light sensor over a dark area of the mat in order to read the minimum value. Then, you press the orange button on the NXT brick (see Figure 8-4). Figure 8-3 is a simple example of such a calibration program. You might want to elaborate on it by adding display prompts to let the user know where he should place the robot’s Light sensor and what to do next.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.