Hi team,
We are using OPT3001DNP(ALS sensor) with Arduino nano and trying to read interrupt signal while reading lux value
we are using 12c communicatin for that and able to read lux value properly but
when we try to observe interrupt signal on DSO by probing, we are not getting any interrupt signal on DSO.
i am attaching the Arduino sketch that we are using .....kindly look in and provide some modifications if required.
#include <Wire.h> #define OPT3001_A_ADDR 0x44 // Light sensor 1 HEX address void setup() { Serial.begin(9600); // Initialize serial communication at 9600 Wire.begin(); // Initialize Arduino in I2C master. Wire.beginTransmission(OPT3001_A_ADDR); // I2C address of OPT3001 = 0x44 Wire.write(0x01); // Config register address 0x01 Wire.write(0xCE); Wire.write(0x10); // Write 0xCE10 to turn on sensor Wire.endTransmission(); Serial.println("Data received \t\t Lux"); } void loop() { Wire.beginTransmission(OPT3001_A_ADDR); Wire.write(0x00); // Send result register address Wire.endTransmission(); delay(100); Wire.requestFrom(OPT3001_A_ADDR, 2); // Request 2 bytes data from OPT3001 uint16_t iData; uint8_t iBuff[2]; while (Wire.available()) { iBuff[0]=Wire.read(); iBuff[1]=Wire.read(); iData = (iBuff[0] << 8) | iBuff[1]; float fLux = SensorOpt3001_convert(iData); // Calculate LUX from sensor data Serial.print(iData,BIN); // Print the received data Serial.print("\t\t"); Serial.println(fLux); // Print it on serial terminal } delay(1000); } float SensorOpt3001_convert(uint16_t iRawData){ uint16_t iExponent, iMantissa; iMantissa = iRawData & 0x0FFF; // Extract Mantissa iExponent = (iRawData & 0xF000) >> 12; // Extract Exponent return iMantissa * (0.01 * pow(2, iExponent)); // Calculate final LUX }