/*GR-SAKURA Sketch Template Version: V1.08*/ #include #include #include //#include byte i2cWriteBuffer[10]; byte i2cReadBuffer[10]; #define SensorAddressWrite 0x29 // #define SensorAddressRead 0x29 // #define EnableAddress 0xa0 // register address + command bits #define ATimeAddress 0xa1 // register address + command bits #define WTimeAddress 0xa3 // register address + command bits #define ConfigAddress 0xad // register address + command bits #define ControlAddress 0xaf // register address + command bits #define IDAddress 0xb2 // register address + command bits #define ColorAddress 0xb4 // register address + command bits #define ColorThreshold 400 // colorThreshold //#define pinR 1 //#define pinG 2 //#define pinB 3 void Writei2cRegisters(byte numberbytes, byte command) { byte i = 0; Wire.beginTransmission(SensorAddressWrite); // Send address with Write bit set Wire.write(command); // Send command, normally the register address for (i=0;i