Package lejos.hardware.sensor
Class HiTechnicMagneticSensor
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.AnalogSensor
-
- lejos.hardware.sensor.HiTechnicMagneticSensor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class HiTechnicMagneticSensor extends AnalogSensor implements SensorConstants
The sensor detects magnetic fields that are present around the front of the sensor in a vertical orientation.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 Magnetic Measures the strength of a vertical magnetic field N/A, normalized getMagneticMode()See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Lawrie Griffiths
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.AnalogSensor
currentType, port
-
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 HiTechnicMagneticSensor(AnalogPort port)Create a magnetic sensor on an analog portHiTechnicMagneticSensor(Port port)Create a magnetic sensor on a sensor port
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SampleProvidergetMagneticMode()HiTechnic Magnetic sensor, Magnetic mode
Measures the strength og the vertical magnetic fieldprotected voidinit()-
Methods inherited from class lejos.hardware.sensor.AnalogSensor
normalize, NXTRawIntValue, NXTRawValue, switchType
-
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
-
HiTechnicMagneticSensor
public HiTechnicMagneticSensor(AnalogPort port)
Create a magnetic sensor on an analog port- Parameters:
port- the analog port
-
HiTechnicMagneticSensor
public HiTechnicMagneticSensor(Port port)
Create a magnetic sensor on a sensor port- Parameters:
port- the analog port
-
-
Method Detail
-
init
protected void init()
-
getMagneticMode
public SampleProvider getMagneticMode()
HiTechnic Magnetic sensor, Magnetic mode
Measures the strength og the vertical magnetic fieldSize and content of the sample
The sample contains one element containing the strength of the magnetic field around the sensor. The value is normalized (0-1) where 1 corresponds with the maximum field strength.
-
-