Your NXT Can Now Sense The Directionals! (For Just $47.00)
Lego is now selling a compass sensor for the NXT. It comes as just itself, but I know what you’d do to program it, and that is explained here. Later this year a official NXT-G block will be released for free download (I’ll post that link here), but currently you’d add a code block for the ultrasonic sensor. But there are a few things you’d want to note and those are these: 1. You need to have the measurement units be centimeters, 2. the ultrasonic sensor can only detect values of 0 to 250, but the sensor will actually be picking up values 0 to 360. To correctly program the sensor you need to know the following: The current heading will be divided by two, so North would be 0, East would be 45, South would be 90, and West would be 135. So, to get the actual heading multiply the value your NXT is getting by 2. You might also be able to still use an actual ultrasonic sensor, you’d just have to make sure the ports (1 to 4) are set properly. The other important piece of information about the compass sensor is that you will need it horizontal, and 6 inches (15 cm) away from the motors (magnetic interference), and 4 inches (10 cm) away from your NXT. To see just the values (View mode), follow these steps, plug the sensor into port 2 (why, I don’t know, any port?). From the main menu View > Ultrasonic cm > Port 2. As you move the sensor the readings will change, North (O) will be displayed as “??????”. All other readings will go from 0 to 179 (all the existent directionals). You’ll also need firmware version 1.03 (an update was posted for this reason: the new sensor/ battery issue).