Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   HiTechnic compass - reading 65535? (http://www.chiefdelphi.com/forums/showthread.php?t=73901)

oddjob 08-02-2009 10:16

HiTechnic compass - reading 65535?
 
Is this how to use the HiTechnic compass?

Code:

  HiTechnicCompass *m_compass;
  float CompassAngle;

....

  m_compass = new HiTechnicCompass(4); // slot 4

....

  CompassAngle = m_compass->GetAngle();

The CompassAngle readings are always 65535.0. We checked the cable continuity from the I2C connector on the sidecar to the compass module and it seems ok. See anything wrong?

EHaskins 08-02-2009 12:24

Re: HiTechnic compass - reading 65535?
 
That looks correct. I looked at some of my compass test code, and I didn't have to do anything else. I wrote my compass code pre-season and I was using an older version of WPILib, so it may have changed since then.

Do you have another compass and cable to test with? Did you try your other DSC?

byteit101 08-02-2009 17:39

Re: HiTechnic compass - reading 65535?
 
do you know because of a printf?
we had a wierd output and it was because it was
printf("%i\n", floatvalue);
when it should have been
printf("%f\n", floatvalue);

oddjob 08-02-2009 22:44

Re: HiTechnic compass - reading 65535?
 
Thanks for the replies. We replaced the cable with another and the problem went away, so it was a bad cable. The code does work and the compass is working well.


All times are GMT -5. The time now is 02:38.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi