so getting device position from an accelerometer and gyroscope is, like, nontrivial, due to noise and very severe error propagation in double-integrating the sensor data. here is a good answer that will smash your dreams.
but i'm just lookin for somethin very very rough..... like, oh, you moved the phone upwards.
runge-kutta would be better than euler integration: python, javascript.
and a kalman filter might help clean up the sensor data.
ugh : )
gnight for now
https://d3js.org/d3.v4.min.js