#include #include #define I2C_PERIFERAL_ADRESS 8 // address on the I2C network #define LDR_PIN 0 const long A = 1000; //Resistance on darkness on KΩ const int B = 27; //Resistance on light (10 Lux) on KΩ const int Rc = 10; //Calibracion resistance on KΩ unsigned int ilum, rawValue; void setup() { //set up pins pinMode(LDR_PIN,INPUT); //Set up I2C bus Wire.begin(I2C_PERIFERAL_ADDRESS); Wire.onRequest(onRequest); } //Function that read the average sensor reading int readSensor(int samples = 10){ long value = 0; for(int i=0; i