UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

TCS37727 Class

Module: tcs37727

Description in web-link above: The TCS3772 device family provides red, green, blue, and clear (RGBC) light sensing and, when coupled with an external IR LED, proximity detection. These devices detect light intensity under a variety of lighting conditions and through a variety of attenuation materials, including dark glass. The proximity detection feature allows a large dynamic range of operation for accurate short distance detection, such as in a cell phone, for detecting when the user positions the phone close to their ear. An internal state machine provides the ability to put the device into a low power state in between proximity and RGBC measurements providing very low average power consumption.

Methods

TCS37727

(
  • bus
  • atime_us
  • devAddr
)
Number

Instantiates an TCS37727 object Settings: Gain 4x, Proximity Detection off

Parameters:

  • bus Number

    Number of the used bus

  • atime_us Number

    RGBC integration time

  • devAddr Number

    Address of the used I2C device

Returns:

Number:

checkID

() Number

Check device_id of sensor

Returns:

Number:

0 on success -1 on error

setActive

() Number

Set active mode, this enables periodic RGBC measurements

Returns:

Number:

0 on success -1 on error

setStandby

() Number

Set standby mode, this disables periodic RGBC measurements Also turns off the sensor when proximity measurement is disabled

Returns:

Number:

0 on success -1 on error

trimGain

(
  • rawc
)
Number

Parameters:

  • rawc Number

    undefined

Returns:

Number:

sampleData

() Number

Read out data of regs and call further function Also saves converted values to variables

Returns:

Number:

0 on success -1 on error

getChannelRed

(
  • bSampleData
)
Number

Get the calculated channel red color

Parameters:

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

The channel red color on success 999 on error

getChannelGreen

(
  • bSampleData
)
Number

Get the calculated channel green color

Parameters:

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

The channel green color on success 999 on error

getChannelBlue

(
  • bSampleData
)
Number

Get the calculated channel blue color

Parameters:

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

The channel blue color on success 999 on error

getChannelClear

(
  • bSampleData
)
Number

Get the calculated channel clear color

Parameters:

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

The channel clear color on success 999 on error

getLux

(
  • bSampleData
)
Number

Get the calculated lux value

Parameters:

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

The lux value on success 999 on error

getColorTemperature

(
  • bSampleData
)
Number

Get the calculated color temperature

Parameters:

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

The color temperature on success 999 on error

getData

(
  • data
  • bSampleData
)
Number

Get calculated sensor values

Parameters:

  • data Tcs37727_data_t

    Calculated sensor values

  • bSampleData Number

    Flag to read sensor

Returns:

Number:

0 on success -1 on error