Let's Make Robots!

arduino uno + adxl345 (arduino 1.0)

Hi, I want to get the horisontal angle in degrees from the adxl345, I have a code that kind of works, but I wonder if someone here have a code that really works.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I have a couple of ADXL345's, have been using them with the library you can find on the bottom of this page -> https://www.loveelectronics.co.uk/products/136/3-axis-accelerometer---adxl345-breakout-board

Sorry I was a bit quick to answer. I can see now that wasn't much help. If I get a chance I'll see what I can work out. I think I have that accelerometer so I can hook it up and see if I can convert that formula or the Atan method here to some code.

do you know how to do that in code?

 

From here it says

atan2 (x, z) and atan2 (y, z) will give you angles from vertical.