I would like to know, what are the advantages of using the full-length accelarometer code found in your website? I was able to get the accelarometer working and printing values by simply doing
Kevin’s code is pretty much the same as what you are doing if you set it to average only a couple samples. If you bump that number up to, say, 16, then you have a much improved acceleration/angular_velocity value.
There’s also a very good bias detection algorithm (its simple too!).
If all you need to do is take a voltage measurement from a potentiometer or an accelerometer (to calculate an angle relative to the gravity vector), then my code is overkill. My code was originally designed to wring out the best possible performance out of a gyroscope and then later modified to sample additional ADC channels while also sampling a gyro. My code also uses oversampling and decimation to gain measurement resolution and lower the noise floor.