Quote:
|
Originally Posted by psquared
We had our accelerometer connected to an Analog port, which we thought it was, but when we printfed the Get_Analog_Value(blah) it showed up some huge number like 17439, the value that we made get_analog_value go to was a double value, and we printfed with %d, when we moved the accelerometer no value changed
should it be an int instead of double?
do you think our connections might be wrong?
should it be digital instead?
or any other thing it might be?
thanks for the help
Chantilly 612
|
You are correct it is an analog input.
The easiest mistake to make is the colors of the wires on the accelerometer are not normal. Check the spec sheet for how they should be swapped around.
Get_Analog_Value returns an int.
When you printf make sure you are printing an int.
The accelerometer should return a value in the neighborhood of
--730 when facing up
--512 when horizontal
--340 when facing down