Class Index | File Index

Classes


Class BO.io.AnalogAccelerometer


Extends BO.PhysicalInputBase.

Creates an interface to an analog accelerometer. Use the accelerometer to read the acceleration along the x, y, and z axis of an object it is attached to. You can also obtain the pitch and roll. This object should interface with most analog accelerometers. See Breakout/examples/sensors/analog_accelerometer.html and Breakout/examples/three_js/accelerometer.html for example applications.

Defined in: AnalogAccelerometer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
BO.io.AnalogAccelerometer(board, xPin, yPin, zPin, dynamicRange, enableSmoothing)
Creates a new Analog Accelerometer object
Field Summary
Field Attributes Field Name and Description
 
[read-only] The current range setting of the accelerometer in units of gravity (9.8 m/sec2).
 
[read-only] The pitch value in degrees
 
[read-only] The roll value in degrees
 
x
[read-only] The x axis of the accelerometer in units of gravity (9.8 m/sec2).
<static> <constant>  
BO.io.AnalogAccelerometer.X_AXIS
 
y
[read-only] The y axis of the accelerometer in units of gravity (9.8 m/sec2).
<static> <constant>  
BO.io.AnalogAccelerometer.Y_AXIS
 
z
[read-only] The z axis of the accelerometer in units of gravity (9.8 m/sec2).
<static> <constant>  
BO.io.AnalogAccelerometer.Z_AXIS
Method Summary
Method Attributes Method Name and Description
 
getCalibratedRange(minVoltage, maxVoltage, supplyVoltage)
Use this method to get the minimum and maximum range values for an axis.
 
setRangeFor(axis, minimum, maximum)
Scale the range for the specified axis (from 0 to 1) to (minimum to maximum).
Methods borrowed from class BO.PhysicalInputBase:
addEventListener, dispatchEvent, hasEventListener, removeEventListener
Event Summary
Event Attributes Event Name and Description
 
The update event is dispatched when the accelerometer values are updated.
Class Detail
BO.io.AnalogAccelerometer(board, xPin, yPin, zPin, dynamicRange, enableSmoothing)
Creates a new Analog Accelerometer object
Parameters:
{IOBoard} board
A reference to the IOBoard instance
{Pin} xPin
A reference to the Pin connected to the x axis of the accelerometer
{Pin} yPin
A reference to the Pin connected to the y axis of the accelerometer
{Pin} zPin
A reference to the Pin connected to the z axis of the accelerometer
{Number} dynamicRange
The range of the acceleromter in Gs (typically 2 or 3 for an analog accelerometer). See the datasheet for the acceleromter to get the exact value.
{Boolean} enableSmoothing
True to enable smoothing, false to disable. Default is false.
Field Detail
{Number} dynamicRange
[read-only] The current range setting of the accelerometer in units of gravity (9.8 m/sec2).

{Number} pitch
[read-only] The pitch value in degrees

{Number} roll
[read-only] The roll value in degrees

{Number} x
[read-only] The x axis of the accelerometer in units of gravity (9.8 m/sec2).

<static> <constant> BO.io.AnalogAccelerometer.X_AXIS

{Number} y
[read-only] The y axis of the accelerometer in units of gravity (9.8 m/sec2).

<static> <constant> BO.io.AnalogAccelerometer.Y_AXIS

{Number} z
[read-only] The z axis of the accelerometer in units of gravity (9.8 m/sec2).

<static> <constant> BO.io.AnalogAccelerometer.Z_AXIS
Method Detail
{Object} getCalibratedRange(minVoltage, maxVoltage, supplyVoltage)
Use this method to get the minimum and maximum range values for an axis. Create a new object to store the return value and then pass obj.min and obj.max along with the respective axis identifier to the setRangeFor method.
Parameters:
{Number} minVoltage
The minimum value reported on the axis
{Number} maxVoltage
The maximum value reported on the axis
{Number} supplyVoltage
The supply voltage of the Acceleromter (enter as 3.3, 3.0, 5.0, etc).
Returns:
{Object} An object containing the min and max range values to be passed to the setRangeFor method.

setRangeFor(axis, minimum, maximum)
Scale the range for the specified axis (from 0 to 1) to (minimum to maximum).
Parameters:
axis
the axis to set new range (AnalogAccelerometer.X_AXIS, AnalogAccelerometer.Y_AXIS or AnalogAccelerometer.Z_AXIS).
{Number} minimum
The new minimum value
{Number} maximum
The new maximum value
Event Detail
{BO.io.AccelerometerEvent.UPDATE} update
The update event is dispatched when the accelerometer values are updated.
This event has the following properties:
{BO.io.AnalogAccelerometer} target
A reference to the AnalogAccelerometer object.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 12 2012 23:27:53 GMT-0400 (EDT)