Package lejos.hardware.sensor
Class HiTechnicBarometer
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.HiTechnicBarometer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class HiTechnicBarometer extends I2CSensor
Hitechnic Barometric sensor
The sensor measures both atmospheric pressure and temperature.The code for this sensor has not been tested. Please report test results to the leJOS forum.
Supported modes Mode name Description unit(s) Getter Pressure Measures atmospheric pressure Pascal getPressureMode()Temperature Measures temperature Degree Celcius getTemperatureMode()Sensor configuration
The sensor can be calibrated for pressure using the calibrate method.See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Matthias Paul Scholz
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description HiTechnicBarometer(I2CPort port)Constructor.HiTechnicBarometer(I2CPort port, int address)Constructor.HiTechnicBarometer(Port port)HiTechnicBarometer(Port port, int address)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalibrate(float pascals)Re-calibrates the sensor.floatgetCalibrationMetric()SensorModegetPressureMode()HiTechnic Barometer, Pressure mode
Measures the atmospheric pressure of the air.SensorModegetTemperatureMode()HiTechnic Barometer, Temperature mode
Measures the temperature of the air.protected voidinit()-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Constructor Detail
-
HiTechnicBarometer
public HiTechnicBarometer(I2CPort port)
Constructor.- Parameters:
port- theI2CPortthe sensor is connected to.
-
HiTechnicBarometer
public HiTechnicBarometer(I2CPort port, int address)
Constructor.- Parameters:
port- theI2CPortthe sensor is connected to.address- the address
-
HiTechnicBarometer
public HiTechnicBarometer(Port port, int address)
-
HiTechnicBarometer
public HiTechnicBarometer(Port port)
-
-
Method Detail
-
init
protected void init()
-
calibrate
public void calibrate(float pascals)
Re-calibrates the sensor.- Parameters:
pascals- the calibration value in pascals
-
getCalibrationMetric
public float getCalibrationMetric()
- Returns:
- the present calibration value in pascals. Will be 0 in case no explicit calibration has been performed.
-
getPressureMode
public SensorMode getPressureMode()
HiTechnic Barometer, Pressure mode
Measures the atmospheric pressure of the air.Size and content of the sample
The sample contains one element containing the atmospheric pressure (in Pascal) of the air.
-
getTemperatureMode
public SensorMode getTemperatureMode()
HiTechnic Barometer, Temperature mode
Measures the temperature of the air.Size and content of the sample
The sample contains one element containing the air temperature (in degree celcius).
-
-