Took me a while to crack this, getting the I2C commands to work on the PCA9622.

This circuit controls a single RGB LED and fades through the colors of the spectrum. Now to find something to light up with it.

With the WRITEI2C commands the PCA9622 wouldn't work unless I took out the register address part of the command. Each WRITEI2C command for this particular device starts with the first byte which is the address pointer (with autoincrement options, used on the "outcolor" subroutine), then the second byte is the data for that particular register. If autoincrement is enabled with the address pointer byte then subsequent bytes go into sequential register addresses starting with the one selected in the pointer byte. That way it's one command to set pwm levels for all 3 colors of the RGB LED.

Print Page