accelerometer changes

-added displacement formula
-added while loop that can be adjusted later on