July 5, 2013 at 4:20 am #10100
The hardware set up is very important. you should pull up the SDA and SCL pins. Also check the port direction of the pins.
If you can get a CRO, check the waveforms on both SDA and SCL. Make sure that the clock appears on the SCL.