Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.phidgets
Class WeightSensorPhidget

    java.lang.Object
      com.phidgets.Phidget
          com.phidgets.WeightSensorPhidget

    public final class WeightSensorPhidget

extends Phidget

This class represents a Phidget Weight Sensor. All methods to read weight data from the weight sensor are implemented in this class.

The Phidget Weight Sensor is simply an electronic scale with a USB interface. It provides one weight value, in kg.

Constructor Summary
`WeightSensorPhidget()`

Method Summary
`void` | `addWeightChangeListener(WeightChangeListener l)` Adds a weight change listener.
`double` | `getWeight()` Returns the sensed weight in kg.
`double` | `getWeightChangeTrigger()` Returns the weight change trigger.
`void` | `removeWeightChangeListener(WeightChangeListener l)`
`void` | `setWeightChangeTrigger(double newVal)` Sets the weight change trigger.

Methods inherited from class com.phidgets.Phidget
`addAttachListener, addDetachListener, addErrorListener, close, equals, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getTag, isAttached, open, openAny, removeAttachListener, removeDetachListener, removeErrorListener, setTag, toString, waitForAttachment`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### WeightSensorPhidget

    public WeightSensorPhidget()
                        throws PhidgetException

Throws:
  `PhidgetException`

Method Detail

### getWeight

    public double getWeight()
                     throws PhidgetException

  Returns the sensed weight in kg. This weight is in kg (kilograms), but can easily be converted into other units. The accuracy, sesitivity and range depends on the scale and version.

  Returns:
    The sensed weight
  Throws:
    `PhidgetException` - If this Phidget is not opened and attached. See `open` for information on determining if a device is attached.

### setWeightChangeTrigger

    public void setWeightChangeTrigger(double newVal)
                                throws PhidgetException

  Sets the weight change trigger. This is the ammount by which the sensed weight must change between WeightChangeEvents. By default this is set to 5.

  Parameters:
    `newVal` - The new trigger value
  Throws:
    `PhidgetException` - If this Phidget is not opened and attached. See `open` for information on determining if a device is attached.

### getWeightChangeTrigger

    public double getWeightChangeTrigger()
                                  throws PhidgetException

  Returns the weight change trigger. This is the ammount by which the sensed weight must change between WeightChangeEvents. By default this is set to 5.

  Returns:
    The trigger value
  Throws:
    `PhidgetException` - If this Phidget is not opened and attached. See `open` for information on determining if a device is attached.

### addWeightChangeListener

    public final void addWeightChangeListener(WeightChangeListener l)

  Adds a weight change listener. The weight change handler is a method that will be called when the weight has changed by at least the `Trigger` that has been set.

  There is no limit on the number of weight change handlers that can be registered for a particular Phidget.

  Parameters:
    `l` - An implemetation of the `WeightChangeListener` interface

### removeWeightChangeListener

    public final void removeWeightChangeListener(WeightChangeListener l)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD