com.sentilla.platform.tmote
Class AccelerationSensor

java.lang.Object
  extended by com.sentilla.platform.tmote.Action
      extended by com.sentilla.platform.tmote.Adc<javax.measure.quantity.Acceleration>
          extended by com.sentilla.platform.tmote.AccelerationSensor
All Implemented Interfaces:
MultipleSensor, Action, Sensor<javax.measure.quantity.Acceleration>

public class AccelerationSensor
extends Adc<javax.measure.quantity.Acceleration>

Sensor class for reading measurements from the JCreate accelerometer. Each instance of this class can read a single axis of the accelerometer. Measurements are returned as an Acceleration quantity in meters/s^2.

See Also:
Adc, Sensor

Field Summary
static byte G_RANGE_1_5
           
static byte G_RANGE_2
           
static byte G_RANGE_4
           
static byte G_RANGE_6
           
static byte X_AXIS
           
static byte Y_AXIS
           
static byte Z_AXIS
           
 
Fields inherited from class com.sentilla.platform.tmote.Adc
adcports, numPortsToRead, PORT_A0, PORT_A1, PORT_A2, PORT_A3, PORT_A4, PORT_A5, PORT_A6, PORT_A7, PORT_AVCC_DIV_2, PORT_TEMPERATURE, PORT_VEREFP, PORT_VREFM_DIV_VEREFM, refvolt, REFVOLT_1_5, REFVOLT_2_5, voltages
 
Fields inherited from class com.sentilla.platform.tmote.Action
actionAuto, actionId, actionState, isolateOwner
 
Fields inherited from interface com.sentilla.system.Action
DONE, ERROR, IDLE, PENDING
 
Constructor Summary
AccelerationSensor(byte adcport, byte gRange)
          Constructor takes two arguments, the pin port associated with an accelerometer axis and the acceleration range.
 
Method Summary
 byte getGRange()
          Returns the current sensitivity setting.
 javax.measure.Measurable<javax.measure.quantity.Acceleration> getResult()
          Returns the Measurable quantity that the sensor read.
 float getVref()
          Returns the current reference voltage value as a float.
 void setAxis(byte b)
          Set the axis that this AccelerationSensor object reads.
 void setGRange(byte b)
          Set the sensitivity level, called G-range, for the accelerometer.
static void setRefVoltage()
          Sets the reference voltage this sensor uses to calibrate the acceleration settings.
 void setSleep(boolean sleep)
          Sets the accelerometer sleep mode on or off.
 
Methods inherited from class com.sentilla.platform.tmote.Adc
getVoltage, read, readMultipleRaw, setRead
 
Methods inherited from class com.sentilla.platform.tmote.Action
block, block, cancel, getActionState, initAction, isDone, lookup, submit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sentilla.system.Action
block, block, cancel, getActionState, isDone, submit
 

Field Detail

G_RANGE_1_5

public static final byte G_RANGE_1_5
See Also:
Constant Field Values

G_RANGE_2

public static final byte G_RANGE_2
See Also:
Constant Field Values

G_RANGE_4

public static final byte G_RANGE_4
See Also:
Constant Field Values

G_RANGE_6

public static final byte G_RANGE_6
See Also:
Constant Field Values

X_AXIS

public static final byte X_AXIS
See Also:
Constant Field Values

Y_AXIS

public static final byte Y_AXIS
See Also:
Constant Field Values

Z_AXIS

public static final byte Z_AXIS
See Also:
Constant Field Values
Constructor Detail

AccelerationSensor

public AccelerationSensor(byte adcport,
                          byte gRange)
Constructor takes two arguments, the pin port associated with an accelerometer axis and the acceleration range. Ports and range should be specified using the static in this class. Refer to the accelerometer datasheet for more information on the sensitivity setting.

Parameters:
adcport - axis port number.
gRange - the sensitivity setting for reading the acceleration.
Method Detail

setGRange

public void setGRange(byte b)
Set the sensitivity level, called G-range, for the accelerometer. This range is specified as m * g, where g is the earth's gravity (9.8m/s^2) and m is a multiple of that value. Use the statics in this class for setting the sensitivity level.

Note: this is a global setting, so all accelerometer readings will reflect this setting, not just the specified axis.

Parameters:
b - GRnage specified as a multiple of earth's gravity.

getGRange

public byte getGRange()
Returns the current sensitivity setting.

Returns:
current sensitivity setting of the accelerometer as a static.

setSleep

public void setSleep(boolean sleep)
Sets the accelerometer sleep mode on or off. The accelerometer can be set to sleep, saving power, using this method.

Parameters:
sleep - true if setting accelerometer to sleep, false if waking up.

setAxis

public void setAxis(byte b)
Set the axis that this AccelerationSensor object reads. Must be called before reading the acceleration value.

Parameters:
b - the axis to read.

setRefVoltage

public static void setRefVoltage()
Sets the reference voltage this sensor uses to calibrate the acceleration settings. This is called on instantiation and generally does not need to be called again. However, if there is a significant change in the reference voltage, this method can be called to recalibrate.


getVref

public float getVref()
Returns the current reference voltage value as a float.

Returns:
the reference voltages used by the acceleration sensor.

getResult

public javax.measure.Measurable<javax.measure.quantity.Acceleration> getResult()
Returns the Measurable quantity that the sensor read.

Specified by:
getResult in interface Sensor<javax.measure.quantity.Acceleration>
Specified by:
getResult in class Adc<javax.measure.quantity.Acceleration>
Returns:
Sensor measurement of type Q.


Copyright © 2007 Sentilla Corporation. All Rights Reserved.