Mega2560 SPI with accelerometer

I am trying to use an ADXL345 accelerometer. SparkFun has a great user guide, but it is specific for the Arduino UNO.

It is here ----> https://www.sparkfun.com/tutorials/240

The problem is that the UNO uses pins 10-13 for CS, SDA, SDO and SCL. However, the Mega2560, which I am using, uses pins 50-53.

Apparently, the SPI.h library takes care of all of the pins according to what type of Arduino you have, except for CS (chip/slave select). I have defined the CS as 53 in the sketch and changed only that in the SparkFun's beginner sketch. This theoretically should be sufficient given that SPI.h takes care of the other pins according to your Arduino type. I am getting an output of "-1" such that the device is not connected.

Please help, thanks in advance.

…not sure, but have read somewhere that pin 10 must be defined output

Remember that the pins are in different order on the Mega:

SS 10 → 53
MOSI 11->51
MISO 12->50
SCK 13 → 52