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?
The accelerometer is definitely an analog sensor. Make sure you have the wires connected correctly; the color code is nonstandard. Black goes to +5 volt power, red goes to ground, and white is the output to the RC.
The value returned by the Get_Analog_Value() function is a ten-bit integer. It can range from 0 to 1023.
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