icommand.platform.nxt
Class I2CSensor

java.lang.Object
  extended by icommand.platform.nxt.I2CSensor
Direct Known Subclasses:
Compass, Ultrasonic

public class I2CSensor
extends java.lang.Object

A sensor wrapper to allow easy access to I2C sensors, like the ultrasonic sensor. Currently uses the default I2C address of 0x02, but some sensors can be connected to same port lines and use different addresses using the Auto Detecting Parallel Architecture (ADPA). Currently unsure if there are commercial port expanders yet to use this function, or whether the Lego Ultrasonic sensor is ADPA compatible.

Author:
BB

Constructor Summary
I2CSensor(Sensor s, byte sensorType)
           
 
Method Summary
 int getId()
           
 java.lang.String getProductID()
          Returns the Product ID as a string.
 java.lang.String getSensorType()
          Returns the type of sensor as a string.
 java.lang.String getVersion()
          Returns the version number of the sensor hardware.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I2CSensor

public I2CSensor(Sensor s,
                 byte sensorType)
Parameters:
s - A sensor. e.g. Sensor.S1
Method Detail

getId

public int getId()

getVersion

public java.lang.String getVersion()
Returns the version number of the sensor hardware. NOTE: A little unreliable at the moment due to a bug in firmware. Keep trying if it doesn't get it the first time.

Returns:
The version number. e.g. "V1.0"

getProductID

public java.lang.String getProductID()
Returns the Product ID as a string. NOTE: A little unreliable at the moment due to a bug in firmware. Keep trying if it doesn't get it the first time.

Returns:
The product ID. e.g. "LEGO"

getSensorType

public java.lang.String getSensorType()
Returns the type of sensor as a string. NOTE: A little unreliable at the moment due to a bug in firmware. Keep trying if it doesn't get it the first time.

Returns:
The sensor type. e.g. "Sonar"