Accelerometer program to use integration to output

I want to use an accelerometer input and integrate it to get a speed output. I'm thinking it shouldn't be that hard sample the input, sample a millis or clock time, then sample both again so I can calculate the change in time and multiple it by the accelerometer input. Then loop it and add the result to the previous result. I know there are a few other calculations that have to be added to the accelerometer input to get a useable speed. But for now I'm just trying to do something that would take an input, even from a potentiometer and integrate it.

I'm sure someone has written something similar.

Thanks Steve

I'd use composite simpsons rule, though you could use trapezoidal instead.

Is there some roadblock in writing it yourself?