Since | Origin / Contributor | Maintainer | Source |
---|---|---|---|
2017-04-02 | tjhowse | tjhowse | tcs34725.c |
This module provides a simple interface to TCS34725 colour/light sensors (Adafruit).
!!! Warning
You must call [`setup()`](#tcs34725setup) before you can start reading values!
Initialization via this call is mandatory before values can be read.
tcs34725.setup()
0
if setup has failed (no sensor connected?), 1
if sensor is TCS34725
tcs34725.setup()
tcs34725.enable(function()
print("TCS34275 Enabled")
clear,red,green,blue=tcs34725.raw()
end)
Enables the sensor. Can be used to wake up after a disable.
tcs34725.enable(function()
print("TCS34275 Enabled")
clear,red,green,blue=tcs34725.raw()
end)
A function called when the sensor has finished initialising.
0
Disables the sensor. Enables a low-power sleep mode.
tcs34725.disable()
0
Reads the clear, red, green and blue values from the sensor.
clear,red,green,blue=tcs34725.raw()
clear, red, green, blue in uint16_t.
Sets the gain of the sensor. Must be called after the sensor is enabled.
tcs34725.setGain(gain)
gain | Gain |
---|---|
0x00 | TCS34725_GAIN_1X |
0x01 | TCS34725_GAIN_4X |
0x02 | TCS34725_GAIN_16X |
0x03 | TCS34725_GAIN_60X |
0
Sets the integration time of the sensor. Must be called after the sensor is enabled.
tcs34725.setIntegrationTime(time)
time | Gain |
---|---|
0xFF | TCS34725_INTEGRATIONTIME_2_4MS |
0xF6 | TCS34725_INTEGRATIONTIME_24MS |
0xD5 | TCS34725_INTEGRATIONTIME_101MS |
0xC0 | TCS34725_INTEGRATIONTIME_154MS |
0x00 | TCS34725_INTEGRATIONTIME_700MS |
0