SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By Kaushik
#188774
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 nay 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.
User avatar
By Ross Robotics
#188806
I assume you can get one accel working on your own. Your main concern when adding more is, if the code is blocking, meaning it's using delay(). If it's using delays, then you need to incorporate nonblocking code. Look at the example "Blink without delay" in the IDE. I haven't looked at the example code that SF gives for the accel, so if you wanted to post a link to it, I can take a look.