All Packages Class Hierarchy This Package Previous Next Index
Class pbsim.Sensor
java.lang.Object
|
+----pbsim.Sensor
- public class Sensor
- extends java.lang.Object
-
ILLEGAL_TEMP_VALUE
-
-
MAX_CUMULATIVE_VALUE
-
-
MAX_RAW_VALUE
-
-
MIN_CUMULATIVE_VALUE
-
-
MODE_BOOL
-
-
MODE_CELSIUS
-
-
MODE_EDGE
-
-
MODE_FAHRENHEIT
-
-
MODE_MASK
-
-
MODE_PERCENT
-
-
MODE_PULSE
-
-
MODE_RAW
-
-
MODE_ROTATION
-
-
SLOPE_MASK
-
-
TYPE_LIGHT
-
-
TYPE_NONE
-
-
TYPE_ROTATION
-
-
TYPE_TEMPERATURE
-
-
TYPE_TOUCH
-
-
getBoolValue()
-
-
getId()
-
-
getMode()
-
-
getRawValue()
-
-
getType()
-
-
getValue()
-
-
percentToRaw(int)
- convert a percent back to a raw value.
-
setCumulativeValue(int)
- set the processed value of a sensor that is in a cumulative mode
(MODE_ROTATION, MODE_EDGE, or MODE_PULSE).
-
setListener(SensorListener)
-
-
setRawValue(int)
- set the raw value of a sensor.
MAX_RAW_VALUE
public static final int MAX_RAW_VALUE
MAX_CUMULATIVE_VALUE
public static final int MAX_CUMULATIVE_VALUE
MIN_CUMULATIVE_VALUE
public static final int MIN_CUMULATIVE_VALUE
ILLEGAL_TEMP_VALUE
public static final int ILLEGAL_TEMP_VALUE
TYPE_NONE
public static final int TYPE_NONE
TYPE_TOUCH
public static final int TYPE_TOUCH
TYPE_TEMPERATURE
public static final int TYPE_TEMPERATURE
TYPE_LIGHT
public static final int TYPE_LIGHT
TYPE_ROTATION
public static final int TYPE_ROTATION
MODE_RAW
public static final int MODE_RAW
MODE_BOOL
public static final int MODE_BOOL
MODE_EDGE
public static final int MODE_EDGE
MODE_PULSE
public static final int MODE_PULSE
MODE_PERCENT
public static final int MODE_PERCENT
MODE_CELSIUS
public static final int MODE_CELSIUS
MODE_FAHRENHEIT
public static final int MODE_FAHRENHEIT
MODE_ROTATION
public static final int MODE_ROTATION
MODE_MASK
public static final int MODE_MASK
SLOPE_MASK
public static final int SLOPE_MASK
getId
public int getId()
getValue
public int getValue()
getRawValue
public int getRawValue()
getBoolValue
public int getBoolValue()
getMode
public int getMode()
getType
public int getType()
setListener
public void setListener(pbsim.SensorListener l)
setRawValue
public synchronized void setRawValue(int v)
- set the raw value of a sensor. The new value won't take effect
until the next time the sensor is sampled (normally every time
PBrick.step() is called).
setCumulativeValue
public synchronized void setCumulativeValue(int v)
- set the processed value of a sensor that is in a cumulative mode
(MODE_ROTATION, MODE_EDGE, or MODE_PULSE). This call is especially
convenient when working with rotation sensors since sending the
correct sequence of raw values to represent rotation through
quadrants is quite tedious. The new value does not take effect
until the next time the sensor is sampled.
percentToRaw
public static int percentToRaw(int percent)
- convert a percent back to a raw value. This method can be used to
determine a raw sensor value that will yield the specified percentage
when a sensor is in SENSOR_MODE_PERCENT mode.
- Parameters:
- percent - desired percentage
- Returns:
- s raw value
All Packages Class Hierarchy This Package Previous Next Index