BO.io.CompassHMC6352 Class
Creates an interface to an HMC6352 Digital Compass module. Use the compass to obtain a heading. You must hold the sensor flat to obtain the most accurate heading value (just like an analog compass). The compass is also useful in obtaining a rotation value in relation to a fixed position. See Breakout/examples/sensors/hmc6352.html and Breakout/examples/processing_js/compass.html for example applications.
Constructor
BO.io.CompassHMC6352
-
board
-
address
Parameters:
-
board
IOBoardThe IOBoard instance
-
address
NumberThe i2c address of the compass module
Item Index
Methods
Properties
Events
Methods
addEventListener
-
type
-
listener
Parameters:
-
type
StringThe event type
-
listener
FunctionThe function to be called when the event is fired
dispatchEvent
-
type
-
optionalParams
Parameters:
-
type
EventThe Event object.
-
optionalParams
ObjectOptional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.
handleI2C
()
private
hasEventListener
-
type
Parameters:
-
type
StringThe event type return {boolean} True is listener exists for this type, false if not.
removeEventListener
-
type
-
listener
Parameters:
-
type
StringThe event type
-
listener
FunctionThe function to be called when the event is fired
sendI2CRequest
-
command
-
data
Send an i2c request command to the board
Parameters:
-
command
Number -
data
Number
startReading
()
Start continuous reading of the sensor.
stopReading
()
Stop continuous reading of the sensor
update
()
protected
To be implemented in subclass
Properties
address
Number
[read-only] The address of the i2c device.
heading
Number
[read-only] The heading in degrees.
I2CBase.I2C_REPLY
Unknown
Events
update
BO.io.CompassEvent.UPDATE
The update event is dispatched when the compass heading is updated.
Event Payload:
-
target
BO.io.CompassHMC6352A reference to the CompassHMC6352 object.