Sequence learning

Hi:

I want to implement some sequence learning on Arduino Uno. For example I have oneLED and one pushbutton and the following secuence is performed several times:

pushbutton is held LED goes on
3 seconds
pushbutton is released and LED goes off
3 seconds

Since this secuence is done by hand the times are not exact I want to get an average of the times so the expected value will be 3 seconds, but how can the actions (LED on and off) be remembered (registered).

Also if after the average is calculated (e.g.: 3.02 sec) and the LED goes on for let's say 5sec. and alert is sent.

Any ideas are welcomed.

Record the millis() function at beginning and end of each part and subtract to find elapsed time. Store this in an array and then export it using the serial command?