Connecting Multiple ADXL345 Accelerometers to an Arduino Mega

Hello everyone,

Before I begin I want to say that I am fairly a beginner when it comes to electronics and robotics. Recently, I have created a robotic arm and I want to create version 2 of that. Part of the project requires me to connect 6 ADXL345 accelerometers to an arduino mega. I have not yet bought any of the parts that I need, I would just like to make sure that I know what to do and how to do it before I begin. To receive data from the accelerometers I am going to use the beginner sample code provided by spark fun. My question to everyone is how should I adjust the code to include the other 5 accelerometers? Just as a heads up to everyone so that you know why I am asking, I am going to map the data coming the accelerometer to servo positions, so that I can control servos with it. Please respond to my question with that in mind. It would be extremely helpful if anyone could please give me a suggestion on what to do and how to go about it.

The ADXL345 appears to be an SPI device. As long as a separate chip select line is used for each one, there is no problem attaching more than one of them to the Arduino. Select which one to read from by setting its chip select pin low (while the others are high).