Aug 28, 2006
First Compass Program
It's not much to look at, but it allowed me to give the sensor an initial test. I verified its results with the compass in my truck! The sensor I am using is an official production line sensor from HiTechnic... it functions exactly as yours will. For now, I do not have the NXT-G COMPASS block yet (but it's coming!) so the workaround is to configure it using the Ultrasonic sensor (pick a port) set to Centimeters. Using the output data plug, I feed that number into a MATH block. You must do this because the value returned by the sensor will be between 0 and 179 degrees. I use the MATH block to multiply the value by 2 and then convert that number to Text... I then feed the text into the DISPLAY block so I can watch the number as I rotate my bot around.
I'm going to play with it some more and build a little more complex routine - will post soon.
Posted by: James Floyd Kelly (Jim) at 8:18 AM