Schau mal hier!

http://www.robot-electronics.co.uk/a..._Tutorial.html

Sinnvoll wäre natürlich wenn die I2C Funktionalität schon fertig ist, dann brauchst du nur mehr die Kommandos zusammen zu Stückeln:

Messung Starten:
i2c_start(); // send start sequence
i2c_tx(0xE0); // SRF08 I2C address with R/W bit clear
i2c_tx(0x00); // SRF08 command register address
i2c_tx(0x51); // command to start ranging in cm
i2c_stop(); // send stop sequence

Messung auslesen:
i2c_start(); // send start sequence
i2c_tx(0xE0); // SRF08 I2C address with R/W bit clear
i2c_tx(0x01); // SRF08 light sensor register address
i2c_start(); // send a restart sequence
i2c_tx(0xE1); // SRF08 I2C address with R/W bit set
lightsensor = i2c_rx(1); // get light sensor and send acknowledge. Internal register address will increment automatically.
rangehigh = i2c_rx(1); // get the high byte of the range and send acknowledge.
rangelow = i2c_rx(0); // get low byte of the range - note we don't acknowledge the last byte.
i2c_stop(); // send stop sequence