/* BM017_Arduino_color_sensing: This program interfaces to the AMS TCS34725 color light to digital converter IC. It uses the Arduino I2C interface. */ #include #include byte i2cWriteBuffer[10]; byte i2cReadBuffer[10]; int LEDSRED=7; //output to red leds pwm int LEDSBLUE=8; //output to Blue leds pwm int LEDSGREN=9;//output to Green leds pwm #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 /* Send register address and the byte value you want to write the magnetometer and loads the destination register with the value you send */ 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