Hi,
I just set up the ADXL335 accelerometer and I am wondering wondering why the raw analog input from this is always an integer?
I tried changing it to a float but I always get whole numbers like 410.00, 409 ect.
The integer values it gives have so low resolution that there is only an input change of 2 over about 30 degrees.
For example when the sensor is at 180deg A0 = 410, when it is at 150deg A0 = 408.
This is a 15% per step.
Obviously I tried scaling it down to voltage but if the raw input has no resolution scaling it doesn't help.
Is it normally that inaccurate or do I have a dud sensor?
This is how I am collecting the data:
const float xpin = A0;
void setup() {
// Start the serial
Serial.begin(9600);
}
void loop() {
// Read the raw x value
float rawX = analogRead(xpin);
delay(1);
// Print the raw x value to serial monitor
Serial.print(rawX);
Serial.print("\n");
}
Thanks for your help