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.

From here it says

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

do you know how to do that in code?

 

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.