|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.nxt.Part ch.aplu.nxt.Sensor ch.aplu.nxt.I2CSensor ch.aplu.nxt.CompassHTSensor
public class CompassHTSensor
Class that represents a compass sensor from HiTechnics. Most of the code and the documentation taken from the leJOS library (lejos.sourceforge.net, with thanks to the autor.
Field Summary |
---|
Constructor Summary | |
---|---|
CompassHTSensor()
Creates a sensor instance connected to port S1. |
|
CompassHTSensor(SensorPort port)
Creates a sensor instance connected to the given port. |
Method Summary | |
---|---|
void |
addCompassListener(CompassListener compassListener)
Registers the given compass listener with default trigger level 180. |
void |
addCompassListener(CompassListener compassListener,
double triggerLevel)
Registers the given compass listener for the given trigger level. |
double |
getDegrees()
Polls the sensor. |
lejos.nxt.addon.CompassHTSensor |
getLejosSensor()
Returns the reference of the the underlying lejos.nxt.CompassSensor. |
double |
setTriggerLevel(double triggerLevel)
Sets a new trigger level and returns the previous one. |
void |
startCalibration()
Starts calibration process. |
void |
stopCalibration()
Stops calibration process. |
Methods inherited from class ch.aplu.nxt.I2CSensor |
---|
getData, getLejosI2CSensor, getLejosPort, getProductID, getVersion, sendData, sendData |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompassHTSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic CompassHTSensor()
Method Detail |
---|
public void addCompassListener(CompassListener compassListener, double triggerLevel)
compassListener
- the CompassListener to become registered.triggerLevel
- the trigger level where the callback is triggered (0..<360)public void addCompassListener(CompassListener compassListener)
compassListener
- the CompassListener to become registered.public double setTriggerLevel(double triggerLevel)
triggerLevel
- the new trigger level
public double getDegrees()
public void startCalibration()
stopCalibration()
public void stopCalibration()
startCalibration()
public lejos.nxt.addon.CompassHTSensor getLejosSensor()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |