#define I2C_ADDR (0x29) 0x39 ?
#define REG_CONTROL 0x00 #define REG_CONFIG 0x01 #define REG_DATALOW 0x04 #define REG_DATAHIGH 0x05 #define REG_ID 0x0A
ecrire 0x80 ecrire 0x03
lire 2 registres 0x04 0x05
The ADC output is a 16-bit number that is directly proportional to the value that approximates the human eye response in the commonly used illuminance unit of lux. The light level can be calculated using the following expression.
Light Level (lux) = MULTIPLIER × [ (DATAHIGH << 8) + DATALOW ] Where: MULTIPLIER = 1 for TCNTRL = 00 (Tint = 400 ms), MULTIPLIER = 2 for TCNTRL = 01 (Tint = 200 ms), and MULTIPLIER = 4 for TCNTRL = 10 (Tint = 100 ms), and << 8 indicates a logical 8-bit shift left operation, and TCNTRL is a 2-bit field in the configuration register (0x01) Example: MULTIPLIER = 1 DATALOW = 0x9C DATAHIGH = 0x63 1 × [ (DATAHIGH << 8) + DATALOW] lux Illuminance = = (0x63 << 8) + 0x9C lux = 0x639C lux = 25,500 lux