Get rid of delay() and use millis() for timing. There are many resources to do timing with miillis() on this forum alone.