One more thing to keep in mind with Highlight Execution is that your program

One more thing to keep in mind with highlight

This preview shows page 4 - 7 out of 13 pages.

One more thing to keep in mind with Highlight Execution is that your program will not run in “real time” while this option is in use. Everything is deliberately slowed down to help you see how the code is proceeding, such as how values are passed from sensors to computations or decisions. Again, this tool is great for debugging and understanding how the NXT will process your program code, but should not be used for normal operation. Activity: Use Highlight Execution mode to look at your simple Sensor/Display code. Since the above code is not a reliable way to instantly and automatically read the value of your sensor, we will use another tool in LabVIEW, the NXT Multimeter, accessed by selecting Tools >> NXT Applications >> NXT Multimeter . When you first open it, it should look like Figure 3. Figure 3: NXT Multimeter Radio buttons: Select which port is being probed. Triangle button: Toggles “real- time display” on/off. Ultrasonic sensor Sound sensor Light sensor Touch sensor Rotation sensor
Image of page 4
- 5 - Module 1, LC 3 A word of caution! The NXT Multimeter doesn’t have its own “window” in Windows. If you try to call it up and it doesn’t appear, it may already be open, and hiding behind other LabVIEW windows. Try to prevent this by moving the Multimeter to its own spot on the computer monitor. On the left side of the Multimeter, you can select which Input port your sensor is plugged into. By default, it assumes you are probing the Touch sensor in Port 1, and tells you that the Touch sensor is “Open” (currently not being pressed). If you hover your mouse arrow over the buttons beneath the black window, you can see what other types of sensors Lego NXT produces. We will focus on the first five buttons. Use the NXT Multimeter to examine the Light, Ultrasonic, Sound, and Rotation sensors. The Rotation sensor is built into the Motors, which are outputs, so for this sensor only, the NXT Multimeter will read Port A as 1, B as 2, and C as 3. Play with all of these sensors until you have a feel for how they work, and fill out Table 1, below, with your findings. Table 1. Behavior of NXT Sensors Sensor type What it measures Type of Value What higher integer value means Maximum value Touch If button is pressed or released Boolean (Open/Closed, equivalent to True/False) n/a n/a Light Sound Ultrasonic (“Sonar”) Rotation Exit out of the NXT Multimeter and return to your Block Diagram. Now that you understand the values output by the sensors, take another moment to review the rest of the options for the Sensor command icon. Notice that the default Port for a Rotation sensor is Port A – an output port! The motors that we have been using have an inherent rotation sensor, which we can manipulate for now by manually turning the motor. The Rotation sensor reads the number of degrees the motor has turned since the sensor was initialized (by default, this sensor is initialized every time you run a new program, but notice that you have the option to “reset” the sensor to read zero whenever you want).
Image of page 5