TCS3471 Color and light sensor IC by AMS Arduino library
Java C++ C
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
TCS3471 first version of library Feb 2, 2013
README.md markup, you are letting me down again Feb 2, 2013

README.md

TCS3471-Arduino-Library

TCS3471 Color and light sensor IC by AMS Arduino library

Link to manufacturer site:

    http://www.ams.com/ger/Products/Light-Sensors/Color-Sensor/TCS34717

Link to TAUTIC ELECTRONICS LLC TCS34717 break-out board on tindie.com:

    https://www.tindie.com/shops/TAUTIC/tcs34717-color-sensor-breakout/

As always with break-outs and cool chips, please read the datasheet. Names of functions and literals reflect terminology in datasheet.

Tested with Arduino 1.0.3 on Arduino Uno, should work on any Arduino and Arduino compatible platform that supports Wire library. Tweaks might apply and your mileage will vary.

Connections between break-out and Arduino Uno to run provided example:

break-out pin   Arduino Uno pin
GND             GND
VCC             5V
SDA             A4
INT             2
SCL             A5
OE              unconnected
EN              unconnected

For SDA and SCL pins on other Arduino boards, please refer to:

    http://arduino.cc/en/Reference/Wire

If you connect break-out board to a 3.3V Arduino, please connect VCC of break-out to 3.3V power supply.

Short function reference:

TCS3471(void (*i2cWriteFunc)(byte,byte,byte*),void (*i2cReadFunc)(byte,byte,byte*))

    constructor of TCS3471 object, please refer to example for implementation details

bool detect()

    function returns true, if TCS3471 chip was found on i2c bus, false if not

bool enable()

    function enables color and light detection on TCS3471 and returns true if chip is     present or false if it is not

void disable()

    disables color and light detection on TCS3471 and puts the chip in powersaving mode

void setIntegrationTime(float integrationTime)

    sets color and light detection cycle length (please read datasheet for details on     what impact this parameter has on detection). Parameter is in milliseconds,     meaningful parameter values are from 2.4ms to 614.4ms in 2.4ms steps.     Function will find closest allowed value to the one that is supplied.

void setWaitTime(float waitTime)

    sets wait cycle length. Parameter in milliseconds, meaningful values from 0     to 7219ms. If set to less than 2.4ms, wait cycle is disabled. From 2.4ms to     614.4ms step size is 2.4ms, from 614.4 and up, step size is 28.8ms

void setGain(tcs3471Gain_t gain)

    sets gain of color and light detector amplifier. possible gain values are     TCS3471_GAIN_1x, TCS3471_GAIN_4x, TCS3471_GAIN_16x and TCS3471_GAIN_60x

void enableInterrupt()

    enables interrupt generation on TCS3471, please read datasheet and look at example     for information on how it is used

void disableInterrupt()

    disables interrupt generation on TCS3471

void clearInterrupt()

    clears interrupt bit in TCS3471 and resets interrupt pin. Interrupt on TCS3471     has to be cleared by master device once it has been handled.     Please note, since TCS3471 has open drain outputs, high voltage means 0 and     low voltage means 1

void interruptHighThreshold(word highThreshold)

    set high threshold for interrupt generation

void interruptLowThreshold(word lowThreshold)

    set low threshold for interrupt generation

void interruptPersistence(byte persistence)

    set number of consecutive times interrupt condition must occur, before interrupt     is generated and interrupt pin asserted

byte getChipID()

    returns chip ID, please refer to datasheet for possible values

bool rgbcValid()

    returns true if RGBC data is valid and can be read, false otherwise

word readCData()

    returns last detected value of C(lear) channel

word readRData()

    returns last detected value of R(ed) channel

word readGData()

    returns last detected value of G(reen) channel

word readBData()

    returns last detected value of B(lue) channel