I moved this post from the interface forum because I felt that it wasn’t so much about interfacing as a general application question
ok, I searched the forum several times and could’nt find much about the Memsic MXD2125 Accelerometer. I recently (xmass! woot!) received the Radio Shack Parallax dual axis accelerometer and have been able to interface it pretty well with the Arduino.
I have the arduino correctly sending back X and Y values from -1000 to 1000 (millig’s) using the pulseIn() function. I also did the trick for using the repetitive pulsIn() function to fix the erratic output when sending both x and Y data back.
I am a bit confused on the conversion scale, the code I found for the arduino and this accelerometer is:
however that gives a multiplication by 18 as the conversion to milliseconds but doing that ends up giving very erroneous data values, on the order of 60,000 when I should be getting around 0 and 1000. I get correct results when I do not multiply by 18.
I am also confused on the arcsin and arccos functions. I have been reading the documentation on the parallax website for this accelerometer (www.parallax.com/rs) but can’t seem to pull out how to do it from there and comparing it with the code at the website link. I am trying to get an actual angle readout sent back to my computer.