Wayne B - 2010-11-26

I recently purchased an NXT Compass Sensor from Lego/HiTechnic.  I'm trying to use it with NXT++ and Visual C++ 2010 Express, but the function "GetCmpsNxValue" is always returning either 0 or 1.

After looking at the nxt++ code and the info about the registers and such at
http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NMC1034 

I suspect that the value being returned by GetCmpsNxValue is simply the "one degree adder". 

With that suspicion, I took a blind stab at fixing GetCmpsNxValue thus: 

//Heading = response[4];
Heading = response[3];
//doubleValue += ((int)Heading * 1.41);
doubleValue += (int)Heading * 2 + (int) response[4];

This returns a range from 0-359 (with 0 in a northern orientation) as I rotate the robot around, so I have some hope it is correct.  Could you comment on whether this is reasonable? 

In any case, thanks a bunch for the NXT++ project!