Package ftclib.sensor

Class FtcI2cAdaFruitColorSensor

All Implemented Interfaces:
TrcSensor.DataSource<FtcI2cAdaFruitColorSensor.DataType>

public class FtcI2cAdaFruitColorSensor extends FtcI2cDevice implements TrcSensor.DataSource<FtcI2cAdaFruitColorSensor.DataType>
This class implements the AdaFruit Color Sensor extending FtcI2cDevice.
  • Field Details

  • Constructor Details

    • FtcI2cAdaFruitColorSensor

      public FtcI2cAdaFruitColorSensor(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int i2cAddress, boolean addressIs7Bit)
      Constructor: Creates an instance of the object.
      Parameters:
      hardwareMap - specifies the global hardware map.
      instanceName - specifies the instance name.
      i2cAddress - specifies the I2C address of the device.
      addressIs7Bit - specifies true if the I2C address is a 7-bit address, false if it is 8-bit.
    • FtcI2cAdaFruitColorSensor

      public FtcI2cAdaFruitColorSensor(String instanceName, int i2cAddress, boolean addressIs7Bit)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      i2cAddress - specifies the I2C address of the device.
      addressIs7Bit - specifies true if the I2C address is a 7-bit address, false if it is 8-bit.
    • FtcI2cAdaFruitColorSensor

      public FtcI2cAdaFruitColorSensor(String instanceName)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
  • Method Details

    • setSensorEnabled

      public void setSensorEnabled(boolean enabled)
      This method enables/disables the sensor.
      Parameters:
      enabled - specifies true to enable sensor, false otherwise.
    • setATime

      public void setATime(byte aTime)
      This method sets the RGBC time.
      Parameters:
      aTime - specifies the RGBC time cycles (see ATIME_*).
    • setWTime

      public void setWTime(byte wTime)
      This method sets the wait time.
      Parameters:
      wTime - specifies the wait time cycles (see WTIME_*).
    • setClearInterruptLowThreshold

      public void setClearInterruptLowThreshold(short threshold)
      This method sets the low threshold for the Clear Interrupt.
      Parameters:
      threshold - specifies the low threshold value.
    • setClearInterruptHighThreshold

      public void setClearInterruptHighThreshold(short threshold)
      This method sets the high threshold for the Clear Interrupt.
      Parameters:
      threshold - specifies the high threshold value.
    • setAGain

      public void setAGain(byte aGain)
      This method sets the RGBC gain control.
      Parameters:
      aGain - specifies the RGBC gain value.
    • getID

      public int getID()
      This method returns the device ID.
      Returns:
      device ID.
    • getStatus

      public int getStatus()
      This method returns the device status.
      Returns:
      device status.
    • getClearValue

      public TrcSensor.SensorData<Integer> getClearValue()
      This method returns the clear value.
      Returns:
      clear value.
    • getRedValue

      public TrcSensor.SensorData<Integer> getRedValue()
      This method returns the red value.
      Returns:
      red value.
    • getGreenValue

      public TrcSensor.SensorData<Integer> getGreenValue()
      This method returns the green value.
      Returns:
      green value.
    • getBlueValue

      public TrcSensor.SensorData<Integer> getBlueValue()
      This method returns the blue value.
      Returns:
      blue value.
    • getRawData

      public TrcSensor.SensorData<Integer> getRawData(int index, FtcI2cAdaFruitColorSensor.DataType dataType)
      This method returns the sensor data of the specified index.
      Specified by:
      getRawData in interface TrcSensor.DataSource<FtcI2cAdaFruitColorSensor.DataType>
      Parameters:
      index - specifies the data index.
      dataType - specifies the data type to return (e.g. rotation rate or heading of a gyro axis).
      Returns:
      sensor data of the specified index.