How to setup and use I2C and SPI on RPi

Guides

Enable Interfaces

Make sure I2C and/or SPI are turned on

sudo raspi-config

Install Software

WiringPi is used to program (download) (docs)

I2C tools

sudo apt-get install -y i2c-tools

i2cdetect program will probe all the addresses on a bus. Read and write registers using the i2cget, i2cset and i2cdump commands.

i2cdetect -Y 1