Demo: Accelerometer

This example reads values from Sparkfun’s ADXL335 3-axis
accelerometer. Because the output of the ADXL335 is between 0-3.3V
and because BeagleBone's analogRead pins are 1.8V tolerant, we used a
hardware (resistor) voltage divider on each of the accelerometer outputs.
This provides a range of 0-1.65V to be read on BeagleBone analogRead pins.

NOTE: Due to output impedance of the ADXL335 being ~32kOhms, a low resistor
value for the voltage divider is recommended (between 500 Ohms- 1k Ohms).

We need to do simple math before we continue. Ultimately, we want to know the
value in G’s being exerted on the accelerometer. The output of the
accelerometer is in volts. The first thing we need to do is calculate a
formula that will convert volts to Gs for us in our software. This formula
for us is: