RoboJDETM v2.0

com.ridgesoft.robotics.sensors
Class DevantechCMPS03I2C

java.lang.Object
  extended by com.ridgesoft.robotics.Compass
      extended by com.ridgesoft.robotics.sensors.DevantechCMPS03I2C

public class DevantechCMPS03I2C
extends Compass

Class to interface with a Devantech CMPS03 magnetic compass attached to an I2C port.


Constructor Summary
DevantechCMPS03I2C(I2CMaster i2cMaster)
          Constructs a Compass object for a CMPS03 compass attached to an I2C bus.
 
Method Summary
 void calibrate()
          Calibrate the compass.
 int getSoftwareRevision()
          Gets the software revsion of the device's software.
 int heading()
          Reads the current heading from the compass.
 
Methods inherited from class com.ridgesoft.robotics.Compass
direction, direction, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait
 

Constructor Detail

DevantechCMPS03I2C

public DevantechCMPS03I2C(I2CMaster i2cMaster)
Constructs a Compass object for a CMPS03 compass attached to an I2C bus.

Parameters:
i2cMaster - I2C object for the bus the compass connects to
Method Detail

calibrate

public void calibrate()
               throws IOException
Calibrate the compass.

The calibration proceedure is as follows:

  1. Set the compass module flat, pointing to North, then call this method.
  2. Set the compass module flat, pointing to East, then call this method.
  3. Set the compass module flat, pointing to South, then call this method.
  4. Set the compass module flat, pointing to West, then call this method.

Throws:
IOException

getSoftwareRevision

public int getSoftwareRevision()
                        throws IOException
Gets the software revsion of the device's software.

Returns:
software revision number
Throws:
IOException

heading

public int heading()
Reads the current heading from the compass.

Specified by:
heading in class Compass
Returns:
heading in degrees (0 - 359) or -1 if compass module does not respond

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com