 // tells that accelerometer data is ready
 volatile bool accDataReady = false;
 
+float lastAccValue = 0.0;
+int lastAccTime = 0;
+float xVelocity = 0.0;
+
 // declarations
 void setupBluetooth();
 bool setupAccelerometer();
 void setDataReady() {accDataReady = true;}
+float trapezoidalRule(float fa, float fb, int dt);
 
 
 void setup() {


// accuracy: +- 2, +- 4, +- 8
#define AccelerationRange MMA_RANGE_2G
#define AccelerationDataRate MMA_50hz


// Used for blinking on error

    Bluetooth.println("DBluetooth module active.");
}

float trapezoidalRule(float fa, float fb, int dt) {
    return (float) dt * fa * fb * 0.5;
}

//float rk4(float(*f)(float, float), float dt, float t, float y)
//{
//    float  k1 = dt * f(t, y),
//            k2 = dt * f(t + dt / 2, y + k1 / 2),
//            k3 = dt * f(t + dt / 2, y + k2 / 2),
//            k4 = dt * f(t + dt, y + k3);
//    return y + (k1 + 2 * k2 + 2 * k3 + k4) / 6;
//
//}

