Show:

BO.io.GyroITG3200 Class

Extends BO.I2CBase

Creates an interface to an ITG3200 3-axis gyroscope. This gyro measures angular acceleration around the x, y, and z axis. This object provides the angular velocity of each axis. Proper calibration is required for an accurate reading. See Breakout/examples/sensors/itg3200.html and Breakout/examples/processing_js/gyro.html for example applications.

Constructor

BO.io.GyroITG3200

(
  • board
  • autoStart
  • address
)

Parameters:

  • board IOBoard

    The IOBoard instance

  • autoStart Boolean

    True if read continuous mode should start automatically upon instantiation (default is true)

  • address Number

    The i2c address of the accelerometer. If pin 9 (AD0) of the module is tied to VDD, then use GyroITG3200.ID_AD0_DVV (0x69), if pin 9 (AD0) is tied to GND, then use GyroITG3200.ID_AD0_GND. Default = GyroITG3200.ID_AD0_VDD

Methods

addEventListener

(
  • type
  • listener
)

Parameters:

  • type String

    The event type

  • listener Function

    The function to be called when the event is fired

dispatchEvent

(
  • type
  • optionalParams
)

Parameters:

  • type Event

    The Event object.

  • optionalParams Object

    Optional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.

handleI2C

() private

Inherited from BO.I2CBase but overwritten in src/io/GyroITG3200.js:302

hasEventListener

(
  • type
)

Parameters:

  • type String

    The event type return {boolean} True is listener exists for this type, false if not.

init

() private

onGyroReady

() private

readGyro

() private

removeEventListener

(
  • type
  • listener
)

Parameters:

  • type String

    The event type

  • listener Function

    The function to be called when the event is fired

sendI2CRequest

(
  • command
  • data
)
protected

Send an i2c request command to the board

Parameters:

  • command Number
  • data Number

setGains

(
  • xGain
  • yGain
  • zGain
)

Set the gain value for the x, y, or z output.

Parameters:

  • xGain Number
  • yGain Number
  • zGain Number

setOffsets

(
  • xOffset
  • yOffset
  • zOffset
)

Offset the x, y, or z output by the respective input value.

Parameters:

  • xOffset Number
  • yOffset Number
  • zOffset Number

setRegisterBit

() private

setRevPolarity

(
  • xPol
  • yPol
  • zPol
)

Set the polarity of the x, y, and z output values.

Parameters:

  • xPol Boolean

    Polarity of the x axis

  • yPol Boolean

    Polarity of the y axis

  • zPol Boolean

    Polarity of the z axis

startReading

()

Start continuous reading of the sensor.

stopReading

()

Stop continuous reading of the sensor.

update

()

Inherited from BO.I2CBase but overwritten in src/io/GyroITG3200.js:238

Sends read request to accelerometer and updates accelerometer values.

Properties

address

Number

[read-only] The address of the i2c device.

GyroITG3200.ID_AD0_VDD

Unknown static

ID = 0x68 if sensor pin 9 (AD0) is tied to Ground.

GyroITG3200.ID_AD0_VDD

Unknown static

ID = 0x69 if sensor pin 9 (AD0) is tied to Power.

I2CBase.I2C_REPLY

Unknown

isRunning

Boolean

[read-only] The state of continuous read mode. True if continuous read mode is enabled, false if it is disabled.

rawX

Number

[read-only] The raw value of the x axis

rawY

Number

[read-only] The raw value of the y axis

rawZ

Number

[read-only] The raw value of the z axis

x

Number

[read-only] The x axis output value in degrees.

y

Number

[read-only] The y axis output value in degrees.

z

Number

[read-only] The z axis output value in degrees.

Events

update

BO.io.GyroEvent.UPDATE

The update event is dispatched when the accelerometer values are updated.

Event Payload: