yes i have accelerometer and gyroscope and magnet sensor so i get all the reads to move
accX[1] = (x - offsetX);
// Mechanical Filtering (remove some noise)
if((accX[1] < 0.2) && (accX[1] > -0.2)) { accX[1] = 0; }
// First X integration:
velocityX[1] = velocityX[0] + accX[0] + (accX[1] -accX[0]);
// Second X integration:
positionX[1] = positionX[0] + velocityX[0] + (velocityX[1] - velocityX[0]);
accX[0] = accX[1];
velocityX[0] = velocityX[1];
if(velocityX[0] < 0) debug = "left";
else if(velocityX[0] > 0) { debug = "right" ; }
else { debug = "stoped"; }
i found this on a physics website for tracking motion but im doing research on it all now. just gotta figure it out so you said make a new post on this matter tho?