ADXL345 accelerometer to arduino mega


I have recently bought the adxl345 accelerometer and would like to interface it with my arduino mega with either an I2C or SPI interface, does anyone know how I could do this, where I could find code that does it or what registers/functions I would need? All I want to do to begin with is to display the readings of the accelerometer in the serial monitor.


I've made a blogpost about connecting adxl345 with Arduino - including code for Arduino and Processing.

I'm using the USB arduino, but in the comments one dude who uses Mega said it works (only you have to alter the wiring of the SCL and SDA pins, as they are different on the Mega from what he says)

Hope it helps :)