Guide to gyro and accelerometer with Arduino including Kalman filtering

mutenroch:
Dear Lauszus,
You said that hopefuly we have millis() in order to measure the time lapse between readings...
I'm searching the way to measure delta time with millis or micros all around the forum and the playground and i just get dispersed clues but nothing useful for a newbie like me...
Could you please take a minute, or any other samaritan soul, to extend the explanation on how to calculate d-time from a sensor reading? Or suggest a paper or a link to work it out by myself?
Thanks in advance!

I always think that examples are easier to understand than a long-winded old man. So, you can take a look at this project: HERE and this code is responsible for setting up the timing loop for the graph:

In the ScrnFuncts Tab, the function:

void drawGraph(unsigned long Pressure) 
  const unsigned long GraphResponsemS = 514286 ; // full screen of 84 slots every 12 hours

To use the time as an event, this code makes it happen:

  PlotTime = TimeMarker + GraphResponsemS;    // this is our trigger to plot

  if (PlotTime < millis() )  // machine clock has advanced beyond trigger, so react
  {

So, what we are really doing is setting up a situation where we wish something to happen at a future time. Then we check with each iteration of the main loop() to see if that has happened; that is we compare the current time (milliseconds) to that future time - when the "future" event is current or past, it is time to act.

After acting, we need to set our trigger event into the future again...

    PlotTime = millis();              // Reset with current time for future event triggering
  }

I have a lots more examples of simple projects on my project page.

Sorry for hijacking the topic.

Ray